/*
 * Battlemap Details — layout desktop, tablet and mobile
 * This stylesheet is loaded only on the Battlemap Details page.
 */

/* ========== PAGE LAYOUT ========== */

/*
 * Desktop: content is one left-hand column; the subscription panel is its
 * sibling. Flexbox therefore stretches the panel to the exact height of the
 * full left content, regardless of how tall a logged-in tier panel becomes.
 */
.dransky-details-wrapper {
  display: flex;
  align-items: stretch;
  gap: 36px;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  padding: 82px 30px 70px;
  background: rgba(18, 18, 18, 0.85);
  color: #f5f5f5;
  box-sizing: border-box;
  overflow: visible;
}

.dransky-details-content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  overflow: visible !important;
}

.dransky-details-primary,
.dransky-details-secondary {
  min-width: 0;
}

.dransky-details-secondary {
  margin-top: 0;
}

.dransky-details-wrapper .dransky-left {
  min-width: 0;
  padding: 0;
  overflow: visible !important;
}

.dransky-details-wrapper .dransky-right {
  flex: 0 0 clamp(290px, 23vw, 460px);
  width: auto;
  min-width: 0;
  padding: 30px 24px;
  background: rgba(30, 30, 30, 0.96);
  border: 0px solid rgba(212, 175, 55, 0.20);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  align-self: stretch;
  position: static;
}

/* ========== INTRO / PREVIEW ========== */

#dransky-back-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0 0 18px !important;
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 6px;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

#dransky-back-button:hover {
  background: rgba(212, 175, 55, 0.14);
  border-color: #d4af37;
  color: #f0c84b !important;
}

.dransky-details-hero {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  min-width: 0;
}

.dransky-preview-container {
  display: flex;
  flex: 0 1 800px;
  flex-direction: column;
  width: min(60%, 800px);
  min-width: 0;
}

.dransky-preview-container .preview-inner {
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 16 / 9;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  background: #080808;
}

.dransky-preview-container #main-preview {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  object-fit: cover;
  border: 0 !important;
  border-radius: 0 !important;
  transition: opacity 0.2s ease;
}

.dransky-preview-container img#main-preview:hover {
  transform: none !important;
}

.dransky-preview-container .dransky-preview-title-overlay {
  min-height: 48px;
  padding: 12px 16px;
  overflow-wrap: anywhere;
}

.dransky-details-intro {
  flex: 1 1 260px;
  min-width: 0;
  padding-top: 2px;
}

.dransky-details-wrapper .dransky-details-title {
  margin: 0 0 12px;
  font-size: clamp(28px, 3.15vw, 42px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.dransky-details-intro .dransky-details-separator {
  margin: 0 0 16px;
}

.dransky-details-description {
  margin: 0;
  color: #ddd;
  font-size: 16px;
  line-height: 1.65;
}

.dransky-right .dransky-details-title {
  font-size: 27px;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

/* ========== ASSETS CAROUSEL ========== */

.dransky-details-secondary > p:first-child {
  margin-top: 30px;
}

.dransky-carousel-container {
  padding: 5px 6px 0;
}

.dransky-asset-carousel {
  gap: 14px;
  padding: 17px 42px;
  box-sizing: border-box;
}

.dransky-asset-item {
  width: 280px;
  height: 158px;
  margin: 0;
  border-radius: 6px;
  overflow: hidden;
}

.dransky-asset-thumb {
  width: 280px;
  height: 158px;
  object-fit: cover;
}

.dransky-asset-item:hover {
  transform: translateY(-3px);
}

.dransky-asset-item:hover .dransky-asset-thumb {
  transform: none !important;
}

.dransky-tier-overlay img:hover,
.dransky-banner-bg:hover,
.dransky-map-card img:hover {
  transform: none !important;
}

/* ========== RELATED MAPS + PROMO ========== */

.dransky-details-secondary .dransky-heading-h3 {
  margin-top: 44px;
}

.dransky-related-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 42px !important;
}

.dransky-related-grid .dransky-map-card {
  min-width: 0;
}

.dransky-related-grid .dransky-map-card:hover {
  transform: translateY(-3px);
}

.dransky-banner-promo {
  border-radius: 8px;
}

.dransky-banner-heading {
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.15;
}

/* ========== TABLET ========== */

@media (max-width: 1180px) {
  /*
   * On tablet/mobile, display: contents exposes primary and secondary as
   * individual grid items, putting the download panel between them without
   * duplicating any markup.
   */
  .dransky-details-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "primary"
      "sidebar"
      "secondary";
    align-items: start;
    gap: 28px;
    padding: 78px 24px 56px;
  }

  .dransky-details-content {
    display: contents;
  }

  .dransky-details-primary {
    grid-area: primary;
  }

  .dransky-details-secondary {
    grid-area: secondary;
  }

  .dransky-details-wrapper .dransky-right {
    grid-area: sidebar;
    position: static;
    width: 100%;
    max-width: none;
    align-self: auto;
  }

  .dransky-right .dransky-details-title {
    font-size: 29px;
  }
}

@media (max-width: 820px) {
  .dransky-details-hero {
    flex-direction: column;
    gap: 22px;
  }

  .dransky-preview-container {
    flex-basis: auto;
    width: 100%;
    max-width: 800px;
  }

  .dransky-details-intro {
    width: 100%;
  }

  .dransky-details-wrapper .dransky-details-title {
    font-size: clamp(27px, 7vw, 38px);
  }

  .dransky-details-secondary .dransky-heading-h3 {
    margin-top: 36px;
  }
}

/* ========== MOBILE ========== */

@media (max-width: 600px) {
  .dransky-details-wrapper {
    gap: 24px;
    padding: 74px 16px 42px;
  }

  #dransky-back-button {
    width: 42px;
    height: 42px;
    margin-bottom: 14px !important;
    font-size: 21px !important;
  }

  .dransky-preview-container .preview-inner {
    aspect-ratio: 16 / 9;
  }

  .dransky-preview-container .dransky-preview-title-overlay {
    min-height: 0;
    padding: 10px 12px;
    font-size: 15px;
  }

  .dransky-details-description {
    font-size: 15px;
    line-height: 1.6;
  }

  .dransky-details-wrapper .dransky-right {
    padding: 24px 18px;
  }

  .dransky-right .dransky-details-title {
    font-size: 25px;
  }

  .dransky-carousel-container {
    padding: 2px 0 0;
  }

  .dransky-asset-carousel {
    gap: 12px;
    padding: 14px 0 16px;
    scroll-padding-inline: 0;
  }

  .dransky-asset-item,
  .dransky-asset-thumb {
    width: min(82vw, 320px);
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .dransky-asset-item {
    flex-basis: min(82vw, 320px);
  }

  /* On a phone, swipe is clearer and safer than arrows over the thumbnail. */
  .dransky-carousel-container .carousel-arrow,
  .dransky-carousel-gradient {
    display: none !important;
  }

  .dransky-details-secondary .dransky-heading-h3 {
    margin-top: 30px;
    font-size: 26px;
  }

  .dransky-related-tags {
    gap: 7px;
  }

  .dransky-tag-badge {
    padding: 4px 8px;
    font-size: 11px;
  }

  .dransky-related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
    margin-bottom: 30px !important;
  }

  .dransky-related-grid .dransky-map-card-title {
    padding: 9px 6px;
    font-size: 13px;
    line-height: 1.3;
  }

  .dransky-banner-promo {
    height: 270px;
  }

  .dransky-banner-overlay {
    padding: 24px 20px;
    background: linear-gradient(
      to right,
      rgba(0, 0, 0, 0.88) 0%,
      rgba(0, 0, 0, 0.68) 85%,
      rgba(0, 0, 0, 0.38) 100%
    );
  }

  .dransky-banner-heading {
    margin-bottom: 16px;
    font-size: 28px;
  }

  .dransky-banner-button,
  .dransky-support-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #foundry-toast {
    bottom: 18px !important;
    width: calc(100% - 32px);
    padding: 14px 16px !important;
  }
}

@media (max-width: 360px) {
  .dransky-related-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dransky-details-wrapper {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* =========================================================
   V8 FIX — preview mount must fill the 16:9 preview stage
   ========================================================= */
.dransky-preview-container .preview-inner {
  position: relative;
  height: 0 !important;
  min-height: 0;
  padding-top: 56.25% !important;
  aspect-ratio: auto;
}

.dransky-preview-container #main-preview-mount {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
