/**
 * Shared public ad shell — left / right sticky slots + below-content (managed ads + placeholders).
 * Include via includes/public_ad_head.inc.php
 */

.ilotto-public-ad-grid.main-grid,
.main-grid.ilotto-public-ad-grid {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr) minmax(0, 220px);
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  align-items: stretch;
}

.logo-cell {
  grid-column: 1 / 4;
  grid-row: 1 / 2;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 20px 0 0 20px;
}

.logo {
  max-width: 180px;
  height: auto;
  filter: drop-shadow(2px 2px 8px #000a);
}

.ad-block--left,
.ad-block.left {
  grid-column: 1 / 2;
  grid-row: 2 / 3;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 10px;
}

.ad-block--right,
.ad-block.right {
  grid-column: 3 / 4;
  grid-row: 2 / 3;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 10px;
  position: relative;
  z-index: 1002;
  pointer-events: none;
}

.ad-block--right .adsense-sidebar,
.ad-block.right .adsense-sidebar,
.ad-block--right #right-ad-slot.has-ad,
.ad-block.right #right-ad-slot.has-ad {
  pointer-events: auto;
}

.ad-block img,
.ad-block video {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#left-ad-slot,
#right-ad-slot,
#below-ad-slot {
  width: 100%;
  display: none !important;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* AdSense sidebars: 300×600 frame only when an ad is present (desktop; slots hidden on mobile via .ad-block rules below) */
@media (min-width: 900px) {
  #left-ad-slot.ad-slot--adsense-sidebar.has-ad,
  #right-ad-slot.ad-slot--adsense-sidebar.has-ad {
    width: 300px;
    min-width: 300px;
    min-height: 600px;
    box-sizing: border-box;
  }
}

/* Sidebars only: dark card chrome (below-content uses compact strip below) */
#left-ad-slot.has-ad,
#right-ad-slot.has-ad {
  display: flex !important;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 215, 0, 0.28);
  border-radius: 12px;
  padding: 10px;
}

/* Below-content AdSense — flows with main column; width matches .main-container (see .ad-below-main) */
#below-ad-slot.ad-slot--below-reserved.has-ad {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: static;
  height: auto;
  min-height: 100px;
  max-height: 160px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  overflow: hidden;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0;
  box-shadow: none;
  outline: none;
}

#below-ad-slot.ad-slot--below-reserved ins.adsbygoogle {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  flex-shrink: 1;
}

#left-ad-slot,
#right-ad-slot {
  position: sticky;
  top: max(12px, calc(50vh - 300px));
}

.ad-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.ad-wrapper img,
.ad-wrapper video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.ad-wrapper a {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Placeholder boxes (AdSense / “AD SPACE”) */
.ad-box {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(8, 12, 18, 0.72);
  border: 1px solid rgba(0, 255, 153, 0.42);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(0, 255, 153, 0.1),
    0 10px 28px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(0, 255, 153, 0.12);
}

.adsense-sidebar {
  position: sticky;
  top: max(12px, calc(50vh - 300px));
  width: 300px;
  max-width: 100%;
  flex-shrink: 0;
}

.ad-box--sidebar {
  width: 300px;
  height: 600px;
  max-width: 100%;
}

.ad-below-main {
  width: 100%;
  max-width: 480px;
  margin-top: 16px;
  margin-bottom: 16px;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

@media (min-width: 900px) {
  .ad-below-main {
    max-width: 400px;
  }
}

.ad-box--responsive {
  width: 100%;
  min-height: 100px;
  max-width: min(728px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.ilotto-public-center-stack.center-stack,
.center-stack.ilotto-public-center-stack {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 16px 10px 0;
  gap: 10px;
}

/* Sidebars: desktop / large tablet only */
@media (max-width: 899px) {
  .ilotto-public-ad-grid.main-grid,
  .main-grid.ilotto-public-ad-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .logo-cell {
    grid-column: 1 / -1;
  }

  .ilotto-public-center-stack.center-stack,
  .center-stack.ilotto-public-center-stack {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .ad-block--left,
  .ad-block.left,
  .ad-block--right,
  .ad-block.right {
    display: none !important;
  }
}

@media (min-width: 900px) {
  .ilotto-public-ad-grid.main-grid,
  .main-grid.ilotto-public-ad-grid {
    grid-template-columns: 300px minmax(0, 1fr) 300px;
  }

  .ilotto-public-center-stack.center-stack,
  .center-stack.ilotto-public-center-stack {
    grid-row: 1 / 3;
    align-self: flex-start;
    padding-top: max(52px, calc(env(safe-area-inset-top, 0px) + 36px));
  }
}
