/* Item page: decluttered info panel (clamped description, big buy buttons, compact compatibility)
   and gallery arrows. Loaded last on item.html; the long selectors and !important are needed to
   beat site-redesign.css. */

body.item-template-page {
  --item-accent: #38bdf8;
  --item-accent-strong: #7dd3fc;
  --item-text: #f4f4ef;
  --item-muted: rgba(244, 244, 239, 0.55);
  --item-line: rgba(255, 255, 255, 0.12);
}

/* ---------- Description: first lines, arrow expands the rest ---------- */
body.item-template-page .item-description.is-clamped {
  max-height: 5.4em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 45%, transparent 100%);
}

.item-desc-more {
  position: relative;
  display: inline-flex;
  width: 28px;
  height: 22px;
  margin-top: -14px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--item-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}

.item-desc-more[hidden] {
  display: none;
}

.item-desc-more:hover {
  color: var(--item-text);
}

/* Expanded text ends normally, so the arrow no longer needs to tuck into it */
.item-desc-more[aria-expanded="true"] {
  margin-top: 0;
}

.item-desc-more svg {
  transition: transform 0.2s ease;
}

.item-desc-more[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* ---------- Buy area: no card around it, just the buttons ---------- */
body.public-studio-page.item-template-page .item-version-row.is-buy-panel {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 12px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.item-template-page .item-version-row.is-buy-panel .item-version-info-col [data-price-scope] {
  display: none !important;
}

/* A single version doesn't need its name repeated above the buttons */
body.item-template-page .item-version-stack > .item-version-row.is-buy-panel:only-child .item-version-info-col {
  display: none !important;
}

body.item-template-page .item-version-row.is-buy-panel .item-version-actions-col,
body.item-template-page .item-version-row.is-buy-panel .item-fuse-unowned-actions {
  align-items: stretch !important;
  width: 100% !important;
  margin-left: 0 !important;
  gap: 10px !important;
}

.item-buy-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

body.public-studio-page.item-template-page .item-version-row .item-buy-choices button[type="button"] {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  width: 100% !important;
  height: 70px !important;
  min-height: 70px !important;
  padding: 0 16px !important;
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  font-size: 15px !important;
  font-weight: 750 !important;
  line-height: 1.1 !important;
  text-transform: none !important;
  cursor: pointer !important;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease !important;
}

/* Price is the headline; the label sits under it */
body.public-studio-page.item-template-page .item-version-row .item-buy-choices button[type="button"] b {
  color: inherit !important;
  font-size: 22px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  letter-spacing: -0.02em !important;
  text-transform: none !important;
}

body.public-studio-page.item-template-page .item-version-row .item-buy-choices button[type="button"] span {
  font-size: 13px !important;
  font-weight: 650 !important;
  opacity: 0.75;
}

body.public-studio-page.item-template-page .item-version-row .item-buy-choices button.item-buy-credits[data-credit-purchase] {
  background: var(--item-accent) !important;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.3) !important;
  color: #03131d !important;
}

body.public-studio-page.item-template-page .item-version-row .item-buy-choices button.item-buy-credits[data-credit-purchase]:hover {
  background: var(--item-accent-strong) !important;
  transform: translateY(-1px);
}

body.public-studio-page.item-template-page .item-version-row .item-buy-choices button.item-buy-usd[data-usd-checkout] {
  background: #f4f4ef !important;
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.12) !important;
  color: #0b0f14 !important;
}

body.public-studio-page.item-template-page .item-version-row .item-buy-choices button.item-buy-usd[data-usd-checkout]:hover {
  background: #ffffff !important;
  transform: translateY(-1px);
}

body.public-studio-page.item-template-page .item-version-row .item-buy-choices button[type="button"].is-loading {
  opacity: 0.65;
  cursor: progress !important;
}

.item-buy-error {
  margin: 0;
  color: #fca5a5;
  font-size: 13px;
}

/* Add to cart spans the full row */
body.item-template-page .item-version-row.is-buy-panel .item-action-btns-row {
  justify-content: space-between !important;
  gap: 14px !important;
}

body.public-studio-page.item-template-page .item-version-row.is-buy-panel .item-add-cart-btn {
  flex: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 46px !important;
  min-height: 46px !important;
  border: 1px solid var(--item-line) !important;
  border-radius: 12px !important;
  background: transparent !important;
  color: var(--item-text) !important;
  font-size: 14px !important;
  font-weight: 650 !important;
}

body.public-studio-page.item-template-page .item-version-row.is-buy-panel .item-add-cart-btn:hover {
  border-color: rgba(255, 255, 255, 0.28) !important;
  background: rgba(255, 255, 255, 0.04) !important;
}

body.public-studio-page.item-template-page .item-version-row.is-buy-panel .item-add-cart-btn.is-in-cart {
  border-color: rgba(52, 211, 153, 0.55) !important;
  color: #34d399 !important;
}


body.item-template-page .item-version-row.is-buy-panel .item-action-subrow {
  justify-content: flex-start !important;
}


/* ---------- Free fuses / macros: one big download button ---------- */
body.public-studio-page.item-template-page .item-version-row a.item-free-download,
body.public-studio-page.item-template-page .item-version-row a.item-builtin-get,
body.public-studio-page.item-template-page .item-version-row.is-owned a.is-primary-download,
body.public-studio-page.item-template-page .item-version-row.is-owned a.item-managed-install-primary,
body.public-studio-page.item-template-page .item-version-row.is-owned a.item-direct-zip-download-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  width: 100% !important;
  height: 64px !important;
  border-radius: 12px !important;
  background: var(--item-accent) !important;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.3) !important;
  color: #03131d !important;
  font-size: 17px !important;
  font-weight: 800 !important;
  text-decoration: none !important;
  transition: background-color 0.15s ease, transform 0.1s ease !important;
}

body.public-studio-page.item-template-page .item-version-row a.item-free-download:hover,
body.public-studio-page.item-template-page .item-version-row a.item-builtin-get:hover,
body.public-studio-page.item-template-page .item-version-row.is-owned a.is-primary-download:hover,
body.public-studio-page.item-template-page .item-version-row.is-owned a.item-managed-install-primary:hover,
body.public-studio-page.item-template-page .item-version-row.is-owned a.item-direct-zip-download-btn:hover {
  background: var(--item-accent-strong) !important;
  transform: translateY(-1px);
}

.item-builtin-note {
  color: var(--item-muted);
  font-size: 13px;
  text-align: center;
}

/* ekFlow 2 has its own older column layout; the buy panel overrides it */
body.public-studio-page.item-template-page .item-version-row.is-ekflow2-product.is-buy-panel .item-version-actions-col,
body.public-studio-page.item-template-page .item-version-row.is-ekflow2-product.is-buy-panel .item-version-actions {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  align-items: stretch !important;
}

body.public-studio-page.item-template-page .item-version-row.is-ekflow2-product.is-buy-panel .item-action-btns-row {
  flex-direction: row !important;
  width: 100% !important;
}

body.public-studio-page.item-template-page .item-version-row.is-ekflow2-product.is-buy-panel .item-before-you-buy-wrap {
  align-self: flex-start !important;
}

/* ---------- Bigger install / claim / download buttons ---------- */
body.public-studio-page.item-template-page .item-managed-install-actions .item-managed-install-primary,
body.public-studio-page.item-template-page .item-managed-install-actions .item-managed-install-claim,
body.public-studio-page.item-template-page .item-direct-zip-download-btn {
  min-height: 52px !important;
  padding: 0 28px !important;
  border-radius: 12px !important;
  font-size: 15px !important;
  font-weight: 750 !important;
}

body.public-studio-page.item-template-page .item-managed-install-actions .item-managed-install-primary {
  border-color: transparent !important;
  background: var(--item-accent) !important;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.3) !important;
  color: #03131d !important;
}

/* ---------- Compatibility: one flat two-column list ---------- */
body.item-template-page .item-compat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  column-gap: 14px !important;
}

/* ---------- Gallery: arrows on the thumbnail row instead of a scrollbar ---------- */
body.item-template-page .steam-thumbs-wrap {
  position: relative;
}

.stage-nav-arrow {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(8, 10, 14, 0.7);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  color: #ffffff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transform: translateY(-50%);
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.stage-nav-arrow[hidden] {
  display: none;
}

.stage-nav-arrow.is-prev { left: 8px; }
.stage-nav-arrow.is-next { right: 8px; }

.stage-nav-arrow:hover {
  background: rgba(8, 10, 14, 0.9);
}

.stage-nav-arrow:active {
  transform: translateY(-50%) scale(0.94);
}

body.item-template-page .steam-thumbs-strip {
  scrollbar-width: none;
}

body.item-template-page .steam-thumbs-strip::-webkit-scrollbar {
  display: none;
}

@media (max-width: 900px) {
  /* No desktop header gap on phones (it showed as an empty band under the header) */
  body.public-studio-page:not(.mockup-home).item-template-page main.item-template {
    padding-top: 0 !important;
  }

  /* The preview is moved under the title on phones (see item.html); give it room */
  .item-info-panel > .item-gallery-panel {
    width: 100% !important;
    margin: 18px 0 8px !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
  }

  /* "Also check out" cards: the phone layout stacked the text under the picture inside a
     fixed-height card, which clipped the text away. Keep picture-left, text-right. */
  body.public-studio-page.item-template-page .item-related-grid .related-horizontal-card {
    grid-template-columns: 140px minmax(0, 1fr) !important;
    height: auto !important;
    min-height: 140px !important;
  }

  body.public-studio-page.item-template-page .item-related-grid .related-horizontal-art {
    height: 100% !important;
    min-height: 140px !important;
  }

  body.item-template-page .related-horizontal-body {
    width: auto !important;
    min-width: 0 !important;
  }
}

@media (max-width: 720px) {
  .item-buy-choices,
  body.item-template-page .item-compat-grid {
    grid-template-columns: 1fr !important;
  }

  .stage-nav-arrow {
    width: 32px;
    height: 32px;
  }
}

/* ---------- "Requires Flash or Flash Air": links to the download ---------- */
body.item-template-page a.item-requires-app {
  color: rgba(255, 255, 255, 0.85);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: underline solid rgba(255, 255, 255, 0.5);
  text-underline-offset: 4px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

body.item-template-page a.item-requires-app:hover {
  color: #ffffff;
  text-decoration-color: #ffffff;
}

/* ---------- Owned: "In your library", one big install/download, quiet raw-file link ---------- */
body.public-studio-page.item-template-page .item-version-row.is-owned.is-buy-panel {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.public-studio-page.item-template-page .item-version-row.is-owned .item-fuse-owned-stack {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  width: 100% !important;
  gap: 10px !important;
}

.item-owned-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: #34d399;
  font-size: 14px;
  font-weight: 700;
}

body.public-studio-page.item-template-page .item-version-row.is-owned a.item-fuse-direct-download-link:not(.is-primary-download) {
  align-self: center !important;
  padding: 2px 0 !important;
  border: 0 !important;
  background: none !important;
  color: var(--item-muted) !important;
  font-size: 13px !important;
  text-decoration: underline !important;
  text-underline-offset: 3px;
}

body.public-studio-page.item-template-page .item-version-row.is-owned .item-before-you-buy-wrap {
  align-self: flex-start !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
}

body.public-studio-page.item-template-page .item-version-row.is-owned .item-fuse-owned-stack a.item-requires-app {
  display: inline !important;
  min-height: 0 !important;
  height: auto !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  text-decoration: underline solid rgba(255, 255, 255, 0.5) !important;
  text-underline-offset: 4px !important;
}

body.public-studio-page.item-template-page .item-version-row.is-owned .item-fuse-owned-stack a.is-primary-download {
  opacity: 1 !important;
  border: 0 !important;
  background: var(--item-accent) !important;
  color: #03131d !important;
  text-decoration: none !important;
}

/* ---------- Features tab retired: the description shows on its own, with no tab row ---------- */
body.item-template-page .item-tabs {
  display: none !important;
}

/* ---------- Phones: the preview leads (tab bar and header already cover navigation) ---------- */
@media (max-width: 900px) {
  body.item-template-page .item-info-panel > .item-back-link,
  body.item-template-page .item-info-panel > .item-header-meta,
  body.item-template-page .item-info-panel > h1[data-item-name] {
    display: none !important;
  }

  body.item-template-page .item-info-panel > .item-gallery-panel {
    margin-top: 6px !important;
  }
}

/* Launch offer under the title (items with "promo" in shop-items.json) */
body.item-template-page .item-info-panel > .item-promo {
  margin: 4px 0 14px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: #f4f4ef;
}

body.item-template-page .item-info-panel > .item-promo s {
  margin-right: 4px;
  color: rgba(244, 244, 239, 0.45);
  font-weight: 600;
}

body.item-template-page .item-info-panel > .item-promo span {
  color: #5ee08a;
}

/* Phones: items running an offer keep their title, so people arriving from a reel see the deal first */
@media (max-width: 900px) {
  body.item-template-page.has-item-promo .item-info-panel > h1[data-item-name] {
    display: block !important;
    margin: 4px 0 2px !important;
    font-size: 30px !important;
    line-height: 1.1 !important;
  }

  body.item-template-page .item-info-panel > .item-promo {
    margin: 2px 0 12px;
    font-size: 16px;
  }
}

/* "Save $X" on the credits button: credits are the cheaper way to pay */
/* Small, quiet note in the corner, so it doesn't push the price/label off center */
body.item-template-page .item-buy-credits {
  position: relative;
}

body.item-template-page .item-buy-credits .item-credit-save {
  position: absolute;
  top: 7px;
  right: 10px;
  margin: 0;
  padding: 0;
  background: none;
  color: rgba(3, 19, 29, 0.62);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* On-site download (e.g. the Flash Download installer): the Buy with USD look, full width, no card */
body.public-studio-page.item-template-page .item-version-row.is-buy-panel a.item-direct-zip-download-btn {
  display: flex !important;
  width: 100% !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  border: 0 !important;
  background: #f4f4ef !important;
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.12) !important;
  color: #0b0f14 !important;
  text-decoration: none !important;
  height: auto !important;
  min-height: 56px !important;
  font-size: 15px !important;
  font-weight: 750 !important;
}

body.public-studio-page.item-template-page .item-version-row.is-buy-panel a.item-direct-zip-download-btn:hover {
  background: #ffffff !important;
  transform: translateY(-1px);
}

body.item-template-page .item-version-row.is-buy-panel .item-action-btns-row:has(.item-direct-zip-download-btn) {
  width: 100%;
}

/* Requirement under an on-site download: small and quiet */
body.item-template-page .item-requirement-note {
  margin: 8px 0 0;
  color: rgba(244, 244, 239, 0.45);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}

/* A frame shaped to its media (galleryAspect): the image fills it exactly */
body.item-template-page .steam-player-stage.has-custom-aspect {
  background: transparent !important;
  border-radius: 12px !important;
}

body.item-template-page .steam-player-stage.has-custom-aspect .steam-stage-media {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

