/* ==================================================== */
/* GAME SHEET v2 (proposal): App Store product-page       */
/* layout. Same markup, same script.js; this file only    */
/* re-arranges the sheet. Loaded after style.css.         */
/*  - header lockup: icon, name, pitch, store buttons     */
/*  - trailer with the selling points beside it           */
/*  - phones: sticky "get it" bar once the store buttons  */
/*    scroll out of view (sheet-v2.js)                    */
/*  - the tapped icon flies into the sheet (sheet-v2.js)  */
/* ==================================================== */

#modal .modal-content > * { min-width: 0; }

/* ---------- Desktop: wide product card ---------- */
@media (min-width: 1080px) {
  #modal .modal-content {
    grid-template-columns: auto minmax(0, 1fr) 44%;
    grid-template-areas:
      "icon     title     badges"
      "icon     shortdesc badges"
      "icon     release   badges"
      "video    video     high"
      "video    video     avail"
      "shots    shots     shots"
      "bullets  bullets   bullets"
      "tags     tags      tags"
      "fulldesc fulldesc  fulldesc";
    column-gap: 0;
    align-content: start;
    text-align: left;
  }

  /* Header lockup */
  #modal .modal-content > .game-icon {
    grid-area: icon;
    width: 132px; height: 132px;
    margin: 30px 24px 0 30px;
    align-self: start;
  }
  #modal .modal-content > #modal-title {
    grid-area: title;
    align-self: end;
    margin: 34px 20px 6px 0;
    font-size: 2.1em;
    line-height: 1.12;
    text-align: left;
    color: #1d2a5e;
  }
  #modal .modal-content > #modal-description-short {
    grid-area: shortdesc;
    align-self: start;
    margin: 0 20px 0 0;
    font-size: 17px;
    text-align: left;
  }
  #modal .modal-content > #modal-release-date {
    grid-area: release;
    margin: 10px 20px 0 0;
    text-align: left;
    transform: none !important; /* the old layout's release-line pin is not needed here */
  }
  #modal .modal-content > #store-badges {
    grid-area: badges;
    align-self: center;
    justify-content: center;
    margin: 30px 30px 0 0;
    padding: 0;
  }

  /* Trailer, with the selling points filling the space beside it */
  #modal .modal-content > .game-video {
    grid-area: video;
    align-self: start;
    margin: 28px 0 0 30px;
  }
  #modal .modal-content > #modal-highlights {
    grid-area: high;
    align-self: start;
    max-width: none;
    margin: 24px 30px 0 8px;
    font-size: 16px;
  }
  #modal .modal-content > #modal-availability {
    grid-area: avail;
    align-self: start;
    margin: 14px 30px 0 34px;
  }
  #modal #modal-availability .avail-row { justify-content: flex-start; }

  /* three store buttons on one line beside the title */
  #modal #store-badges a img.store-badge { height: 56px; }
  #modal .epic-badge-rect { height: 56px; }
  #modal #store-badges { gap: 0.8rem; }

  /* width:auto - the strip's 100% width plus its side margins made the sheet scroll sideways */
  #modal .modal-content > .screenshots { margin: 24px 30px 0 30px; width: auto; }
  #modal .modal-content > #modal-description-full-container { margin: 16px 30px 30px 30px; }

  #sheet-bar { display: none !important; }
}

/* ---------- Phones and tablets: portrait sheet ---------- */
@media (max-width: 1079px) {
  #modal .modal-content {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "video    video"
      "icon     title"
      "icon     shortdesc"
      "release  release"
      "badges   badges"
      "avail    avail"
      "shots    shots"
      "bullets  bullets"
      "tags     tags"
      "high     high"
      "fulldesc fulldesc"
      "bar      bar";
    align-content: start;
  }
  #modal .modal-content > .game-video                       { grid-area: video; margin-bottom: 16px; }
  #modal .modal-content > .game-icon                        { grid-area: icon; width: 88px; height: 88px; margin: 0 14px 0 16px; align-self: start; }
  #modal .modal-content > #modal-title                      { grid-area: title; margin: 2px 16px 4px 0; font-size: 1.35em; line-height: 1.15; text-align: left; align-self: end; color: #1d2a5e; }
  #modal .modal-content > #modal-description-short          { grid-area: shortdesc; margin: 0 16px 0 0; font-size: 14.5px; line-height: 1.45; text-align: left; align-self: start; }
  #modal .modal-content > #modal-release-date               { grid-area: release; margin: 16px 16px 0 16px; }
  #modal .modal-content > #store-badges                     { grid-area: badges; }
  #modal .modal-content > #modal-availability               { grid-area: avail; }
  #modal .modal-content > #modal-screenshots                { grid-area: shots; }
  #modal .modal-content > #screenshot-bullets               { grid-area: bullets; }
  #modal .modal-content > #game-tags                        { grid-area: tags; }
  #modal .modal-content > #modal-highlights                 { grid-area: high; justify-self: center; }
  #modal .modal-content > #modal-description-full-container { grid-area: fulldesc; }

  /* Sticky "get it" bar: slides up once the store buttons have scrolled away */
  #sheet-bar {
    grid-area: bar;
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid #e3e6f2;
    transform: translateY(105%);
    visibility: hidden;
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1), visibility 0s linear 0.25s;
  }
  #sheet-bar.on { transform: translateY(0); visibility: visible; transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1), visibility 0s; }
  #sheet-bar img.sb-icon { width: 40px; height: 40px; border-radius: 22%; flex: none; }
  #sheet-bar .sb-name { flex: 1; min-width: 0; font-family: 'MyGameFont', sans-serif; font-size: 14px; line-height: 1.2; color: #1d2a5e; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #sheet-bar .sb-btn {
    flex: none;
    font-family: 'MyGameFont', sans-serif; font-size: 13px; text-decoration: none;
    color: #fff; background: #1d2a5e;
    border: 0; border-radius: 999px;
    padding: 10px 16px;
    cursor: pointer;
  }
  #sheet-bar .sb-btn + .sb-btn { margin-left: -4px; }
}

@media (prefers-reduced-motion: reduce) {
  #sheet-bar, #sheet-bar.on { transition: none; }
}

/* ---------- Opening: the tapped icon flies into the sheet ---------- */
/* (View Transitions; browsers without it simply get the normal slide-up) */
.sheet-vt .modal,
.sheet-vt .modal-content { transition: none !important; }
::view-transition-group(game-icon) { animation-duration: 0.42s; animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.28s; }

/* ==================================================== */
/* Readability and finish (2026-11 pass)                 */
/* ==================================================== */

/* Reading text in the system sans, like the homepage; the slab stays for titles and labels */
#modal #modal-description-short,
#modal .game-highlights,
#modal #modal-description-full-text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  color: #2a2f4a;
}
#modal .game-highlights li::before { top: 3px; }
#modal .store-rating { font-size: 14px; }
#modal .modal-subscribe .game-subscribe-note { font-size: 13px; }

/* Trailer poster: the key art with a play button; YouTube loads only on click */
#modal .trailer-poster {
  display: block; position: relative;
  width: 100%; aspect-ratio: 16 / 9;
  padding: 0; border: 0; cursor: pointer; overflow: hidden;
  background: #0e1638;
  border-radius: 12px 12px 0 0;
}
#modal .trailer-poster img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.3, 1); }
#modal .trailer-poster:hover img { transform: scale(1.03); }
#modal .trailer-poster .tp-play {
  position: absolute; left: 14px; bottom: 14px;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 46px; box-sizing: border-box; padding: 0 20px 0 16px;
  border-radius: 999px;
  font-family: 'MyGameFont', sans-serif; font-size: 15px; letter-spacing: 0.04em; white-space: nowrap;
  color: #fff; background: rgba(13, 19, 52, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.4);
  transition: background 0.15s ease, color 0.15s ease;
}
#modal .trailer-poster .tp-play svg { width: 20px; height: 20px; fill: currentColor; }
#modal .trailer-poster:hover .tp-play { background: #fff; color: #1d2a5e; }
#modal .trailer-poster:focus-visible { outline: 3px solid #4a478a; outline-offset: 3px; }

/* On a game's own page the close button says where it leads */
body[data-game-page] .modal-close {
  width: auto; gap: 8px; padding: 0 16px 0 13px; border-radius: 999px;
  font-family: 'MyGameFont', sans-serif; font-size: 13px; letter-spacing: 0.04em; color: #fff;
}
body[data-game-page] .modal-close::after { content: "All games"; }
body[data-game-page] .modal-close:hover, body[data-game-page] .modal-close:focus { transform: scale(1.05); }

@media (min-width: 1080px) {
  #modal .trailer-poster { border-radius: 14px; box-shadow: 0 10px 30px rgba(8, 14, 50, 0.25); }
  /* selling points at the top of the column, platform chips level with the trailer's bottom edge:
     the spare height sits between them instead of splitting the column at random */
  #modal .modal-content > #modal-availability { align-self: end; margin-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #modal .trailer-poster img, #modal .trailer-poster .tp-play { transition: none; }
  #modal .trailer-poster:hover img { transform: none; }
}

/* ==================================================== */
/* Description, quotes, own-store button, viewer arrows  */
/* ==================================================== */

/* Description: real headings, paragraphs and star lists (built by formatDescription in script.js) */
#modal #modal-description-full-text h3 {
  margin: 1.5em 0 0.5em 0;
  font-family: 'MyGameFont', sans-serif; font-weight: normal; font-size: 0.82em;
  letter-spacing: 0.14em; text-transform: uppercase; color: #1d2a5e;
  break-after: avoid;
}
#modal #modal-description-full-text > :first-child { margin-top: 0; }
#modal #modal-description-full-text p { margin: 0 0 0.9em 0; }
#modal #modal-description-full-text ul { list-style: none; margin: 0 0 0.9em 0; padding: 0; }
#modal #modal-description-full-text li { position: relative; padding-left: 22px; margin: 0 0 0.5em 0; break-inside: avoid; }
#modal #modal-description-full-text li::before { content: "\2726"; position: absolute; left: 0; top: 0.2em; font-size: 0.75em; color: #4a478a; }
#modal #modal-description-full-text strong { color: #1d2a5e; font-weight: 600; }
#modal #modal-description-full-text > :last-child { margin-bottom: 0; }
/* phones: folded to a few lines that fade out, until "Show More" */
#modal #modal-description-full-text.desc-collapsed {
  max-height: 10.5em; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
  mask-image: linear-gradient(#000 55%, transparent);
}

/* Press quotes, at the top of the description panel */
#sheet-quotes {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 28px;
  margin: 0 0 22px 0; padding: 0 0 22px 0;
  border-bottom: 1px solid #e0e3f1; text-align: left;
}
#sheet-quotes figure { margin: 0; padding-left: 14px; border-left: 3px solid #f5a623; }
#sheet-quotes blockquote { margin: 0; font-family: 'HeadlineFont', serif; font-size: 16px; line-height: 1.45; color: #1d2a5e; }
#sheet-quotes figcaption {
  margin-top: 6px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px; color: #5d6285;
}
#sheet-quotes figcaption a { color: inherit; }

@media (max-width: 1079px) {
  #sheet-quotes { grid-template-columns: 1fr; margin-bottom: 16px; padding-bottom: 16px; }
  #sheet-quotes blockquote { font-size: 15px; }

  /* The visitor's own store leads on its own row; the other store sits smaller underneath */
  #modal #store-badges.dev-ios .col-as,
  #modal #store-badges.dev-android .col-gp { order: -1; flex: 0 0 100%; }
  #modal #store-badges.dev-ios .col-as img.store-badge,
  #modal #store-badges.dev-android .col-gp img.store-badge { height: 58px; }
  #modal #store-badges.dev-ios .col-gp img.store-badge,
  #modal #store-badges.dev-android .col-as img.store-badge { height: 42px; }
  #modal #store-badges.dev-ios .col-gp,
  #modal #store-badges.dev-android .col-as { align-self: center; }
}

/* Screenshot viewer: previous / next */
#screenshot-modal .shot-nav {
  display: none;
  position: fixed; top: 50%; z-index: 10002;
  width: 48px; height: 48px; margin-top: -24px; padding: 0;
  align-items: center; justify-content: center;
  border-radius: 50%; cursor: pointer;
  color: #fff; background: rgba(13, 19, 52, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition: background 0.15s ease, color 0.15s ease;
}
#screenshot-modal.show.has-nav .shot-nav { display: inline-flex; }
#screenshot-modal .shot-prev { left: 14px; }
#screenshot-modal .shot-next { right: 14px; }
#screenshot-modal .shot-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#screenshot-modal .shot-nav:hover { background: #fff; color: #1d2a5e; }
@media (max-width: 600px) {
  #screenshot-modal .shot-nav { width: 44px; height: 44px; margin-top: -22px; }
  #screenshot-modal .shot-prev { left: 6px; }
  #screenshot-modal .shot-next { right: 6px; }
}
