/* RarePepeWorld — design tokens & base (v1 style, responsive) */
:root {
  --rpw-green: #7FCE65;
  --rpw-blue: #B2E6FB;
  --rpw-cream: #F6F6F4;
  --rpw-card-radius: 16px;
  --rpw-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --rpw-shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  text-align: center;
  background-color: var(--rpw-blue);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#main-title {
  text-decoration: none;
  color: black;
}

.undecorated, .link-undecorated {
  text-decoration: none;
  color: black;
}
.link-undecorated:hover { color: #333; opacity: 0.9; }

#featured-section-base, #pepe-details-section-base {
  background-color: var(--rpw-blue);
}

#dispensers-section, #order-list-section {
  background-color: var(--rpw-cream);
  min-height: 200px;
}

#pepe-info-section {
  background-color: var(--rpw-cream);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--rpw-card-radius);
  padding: 1.25rem;
  box-shadow: var(--rpw-shadow-sm);
  min-width: 0;
}

/* ----- Header & footer (responsive) ----- */
#main-header {
  background-color: var(--rpw-green);
  box-shadow: var(--rpw-shadow-sm);
}

#main-header .container { max-width: 900px; }

#main-title-heading {
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

#main-title-heading img {
  height: clamp(36px, 10vw, 50px);
  width: auto;
}

#main-header p {
  font-size: clamp(0.85rem, 2vw, 1rem);
  margin-bottom: 0.75rem;
}

#section-search {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

#search-input {
  background-color: var(--rpw-cream);
  font-weight: 600;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
#search-input:focus {
  border-color: var(--rpw-green);
  box-shadow: 0 0 0 2px rgba(127, 206, 101, 0.25);
}

#footer {
  background-color: var(--rpw-green);
  box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.06);
}

#footer p { margin-bottom: 0.35rem; }
#copyright { margin-bottom: 0.5rem; font-weight: 500; line-height: 1; }

/* ----- Featured Pepe slot (inner .pepe-card-slot defines aspect ratio; no double height) ----- */
.featured-pepe-slot {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  overflow: visible;
}

.featured-pepe-slot .pepe-card-slot {
  border-radius: var(--rpw-card-radius);
  box-shadow: var(--rpw-shadow);
}

/* Legacy: direct img inside featured slot (if used elsewhere) */
.featured-pepe-slot > img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  max-width: none;
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: var(--rpw-card-radius);
}

/* ----- Asset page: pepe image & details ----- */
.pepe-image {
  border-radius: var(--rpw-card-radius);
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
  box-shadow: var(--rpw-shadow);
}

.pepe-image-desktop { padding-left: 0; }

.pepe-details-head, .pepe-details-data { text-align: left; }

#pepe-details-main {
  max-width: 100%;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  overflow-x: hidden;
}

#pepe-content .row > [class*="col-"] {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

#pepe-image-link {
  display: block;
  max-width: 100%;
}

/* ----- Tables ----- */
table { width: 100%; border-collapse: collapse; }
tr:nth-of-type(odd) { background: #eee; }
th { background: #000; color: white; font-weight: bold; }
td, th { padding: 0.5rem 0.6rem; border: 1px solid #ccc; }

#address_truncated { font-size: 0.8rem; }

#topTabs li a, #bottomTabs li a {
  background-color: #ccc;
  border: thin solid black;
  color: black;
}
#topTabs li a.active, #bottomTabs li a.active {
  border-bottom-color: transparent;
  background-color: var(--rpw-cream);
}

#xcp-warning { font-size: 0.9em; }
#xcp-warning a { color: #8CB8CE; }
#dispensers-heading { color: #A5A5A5; }

.sub-data { font-size: 0.75rem; }

.card-image.rounded, .dispenser-image.rounded { border-radius: 12px; }

/* ----- Card grids (search, address, artist, index random) ----- */
#card-list-section-base .row,
#latest-dispensers-section-row,
#featured-section-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}

#card-list-section-base .row > [class^="col"],
#latest-dispensers-section-row > .col,
#featured-section-row > .col {
  flex: 0 0 auto;
  padding: 0.5rem;
}

#featured-section-row {
  min-height: 320px; /* keep section visible even before images load */
}

#featured-section-row > .col {
  width: 100%;
  max-width: 320px;
  min-width: 200px;
}

#latest-dispensers-section-row > .col {
  width: 50%;
  min-width: 120px;
  max-width: 180px;
}

#card-list-row .col {
  width: 50%;
  min-width: 140px;
  max-width: 200px;
}

/* Shared card image slot: same aspect ratio as Rare Pepe cards (400×560) for loaded images and placeholder */
.pepe-card-slot {
  position: relative;
  width: 100%;
  padding-bottom: 140%;
  overflow: hidden;
  border-radius: 12px;
  background: #e9ecef;
  margin: 0 auto;
}
.pepe-card-slot a {
  position: absolute;
  inset: 0;
  display: block;
}
.pepe-card-slot .card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  margin: 0;
}

#card-list-row .col .pepe-card-slot,
#featured-section-row .pepe-card-slot {
  max-width: 100%;
}

#featured-section-row .featured-pepe-slot {
  min-height: 320px;
}

/* ----- Wiki (lore / card story) — same card as pepe-info-section ----- */
#wiki-section {
  background-color: var(--rpw-cream);
  border-radius: var(--rpw-card-radius);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--rpw-shadow-sm);
  min-width: 0;
}

#wiki-section .wiki-section-heading {
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-weight: 600;
  color: #333;
}

#wiki-content {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: visible;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  text-align: left;
  box-sizing: border-box;
}

#wiki-content pre {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

/* Prose styling for rendered markdown — no horizontal scroll ever */
.wiki-markdown {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  line-height: 1.6;
  color: #1a1a1a;
  overflow-wrap: break-word;
  word-break: break-word;
}

.wiki-markdown a {
  word-break: break-word;
}

.wiki-markdown > *:first-child { margin-top: 0; }
.wiki-markdown > *:last-child { margin-bottom: 0; }

.wiki-markdown h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  color: #111;
}

.wiki-markdown h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem 0;
  color: #222;
}

.wiki-markdown h3 { font-size: 1.05rem; margin: 1rem 0 0.4rem 0; }

.wiki-markdown p {
  margin: 0 0 0.85rem 0;
  font-size: 0.95rem;
}

.wiki-markdown strong { font-weight: 600; color: #111; }

.wiki-markdown a {
  color: #0d6efd;
  text-decoration: none;
}
.wiki-markdown a:hover { text-decoration: underline; }

.wiki-markdown ul, .wiki-markdown ol {
  padding-left: 1.5rem;
  margin: 0 0 0.85rem 0;
}
.wiki-markdown li { margin-bottom: 0.25rem; }

.wiki-markdown em { font-style: italic; }

.wiki-markdown blockquote {
  margin: 0.85rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--rpw-green);
  color: #444;
  font-size: 0.95rem;
}

.wiki-markdown table {
  max-width: 100%;
  table-layout: fixed;
}
.wiki-markdown th,
.wiki-markdown td {
  word-break: break-word;
  overflow-wrap: break-word;
}

#wiki-empty {
  max-width: 100%;
  overflow-x: hidden;
  word-wrap: break-word;
  text-align: left;
  font-size: 0.95rem;
  color: #555;
}

#wiki-loading {
  text-align: left;
}

/* ----- Section headings ----- */
#featured-section-heading,
#latest-dispensers-section-heading,
#card-list-heading {
  font-size: clamp(1rem, 3vw, 1.25rem);
}

/* ----- Tablet: more columns ----- */
@media (min-width: 576px) {
  #section-search { max-width: 420px; }
  #latest-dispensers-section-row > .col { width: 33.333%; max-width: none; }
  #card-list-row .col { width: 33.333%; max-width: none; }
}

@media (min-width: 768px) {
  #featured-section-row > .col { width: 50%; max-width: 400px; }
  #pepe-content .row > .col-md-5 { padding-left: 1rem; padding-right: 1rem; }
  #pepe-content .row > .col-md-7 { padding-left: 1rem; padding-right: 1rem; }
  #latest-dispensers-section-row > .col { width: 25%; }
  #card-list-row .col { width: 25%; }
}

@media (min-width: 992px) {
  #section-search { width: 40%; max-width: 400px; }
  #featured-section-row > .col { width: auto; max-width: 420px; }
  #latest-dispensers-section-row > .col { width: 16.666%; min-width: 0; }
  #card-list-row .col { width: 16.666%; min-width: 0; }
}

/* ----- Mobile: compact header/footer ----- */
@media (max-width: 575px) {
  #main-header .jumbotron { padding-top: 1rem; padding-bottom: 1.5rem; }
  #main-header .container { padding-left: 0.75rem; padding-right: 0.75rem; }
  #footer .jumbotron { padding: 0.75rem; }
  #pepe-info-section { padding: 1rem; }
  #wiki-section { padding: 0.75rem 1rem; }
}

/* ----- Pepe image lightbox (full-view, dimmed backdrop) ----- */
.pepe-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
}

.pepe-lightbox.pepe-lightbox-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.pepe-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  cursor: pointer;
}

.pepe-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.pepe-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.pepe-lightbox-wrap {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: 100%;
  max-height: 100%;
}

.pepe-lightbox-img {
  max-width: min(95vw, 1200px);
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--rpw-card-radius);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5);
}

.pepe-lightbox-open-tab {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

.pepe-lightbox-open-tab:hover {
  color: #fff;
}
