/* gallery.css — NFT gallery grid + cards */
*, *::before, *::after { box-sizing: border-box; }

/* ── Body ──────────────────────────────────────────────────── */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #fff;
  -webkit-text-size-adjust: 100%; /* prevent iOS font scaling */
  text-size-adjust: 100%;
}


/* ── Main ──────────────────────────────────────────────────── */
main {
  padding: 10px;
}

/* ── Grid ──────────────────────────────────────────────────── */
.nft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
}

/* Tablet */
@media (max-width: 640px) {
  .nft-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }
}

/* Small phone */
@media (max-width: 360px) {
  .nft-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

/* ── Card ──────────────────────────────────────────────────── */
.nft-item {
  background: #f9f3d7;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  /* consistent card height via flex column + fixed description */
}

.nft-item:hover {
  box-shadow: 0 4px 18px rgba(0,0,0,0.14);
  transform: translateY(-2px);
}

/* ── Image container — square aspect ratio ─────────────────── */
.image-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #e8e8e8;
  /* fallback for browsers without aspect-ratio */
  min-height: 0;
}

/* aspect-ratio fallback for older Safari / Chrome <88 */
@supports not (aspect-ratio: 1) {
  .image-container::before {
    content: '';
    display: block;
    padding-top: 100%;
  }
  .image-container > * {
    position: absolute;
    inset: 0;
  }
}

.nft-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

/* Subtle hover zoom — NOT 3.1× */
.nft-item:hover .nft-thumbnail {
  transform: scale(1.06);
}

/* Burned state */
.image-container.burned .nft-thumbnail {
  filter: grayscale(0.75) opacity(0.55);
}

.burned-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  color: #ff6b6b;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 2px;
  pointer-events: none;
}

.nft-flag-badge {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background: rgba(0,0,0,0.4);
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 1rem;
  line-height: 1;
  pointer-events: none;
}

.nft-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #bbb;
  background: #f0f0f0;
}

/* ── Card body ─────────────────────────────────────────────── */
.nft-details {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.nft-details h3 {
  margin: 0 0 4px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #222;
  line-height: 1.3;
  /* clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Description — fixed height, scrollable ────────────────── */
.nft-details .description {
  margin: 0 0 6px;
  font-size: 0.76rem;
  color: #555;
  line-height: 1.45;
  /* 3-line fixed height — keeps all cards consistent */
  height: calc(1.45em * 3);
  overflow-y: auto;
  overflow-x: hidden;
  /* thin scrollbar — only visible when needed */
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.nft-details .description::-webkit-scrollbar {
  width: 3px;
}

.nft-details .description::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

/* ── Hierarchy path ────────────────────────────────────────── */
.hierarchy-path {
  font-size: 0.68rem;
  color: #999;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sale status ───────────────────────────────────────────── */
.sale-status-area {
  margin-top: auto;
  padding-top: 4px;
}

.price-info {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.sale-price {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1a7a1a;
}

.sale-type {
  margin: 0;
  font-size: 0.72rem;
  color: #666;
}

.not-for-sale-marker {
  font-size: 0.72rem;
  color: #999;
}

.sale-checking {
  color: #888;
  font-size: 0.78rem;
}

.burned-status {
  font-size: 0.72rem;
  color: #cc4444;
}

.has-offers-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  background: rgba(255,0,204,0.08);
  border-radius: 3px;
  font-size: 0.72rem;
  color: #c0c;
}

/* ── Buttons ───────────────────────────────────────────────── */
.nft-item button,
.buy-button {
  margin-top: 6px;
  padding: 8px 10px;
  width: 100%;
  border: none;
  border-radius: 5px;
  background: #333;
  color: #fff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  min-height: 38px; /* touch-friendly */
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.nft-item button:hover,
.buy-button:hover {
  background: #555;
}

.nft-item button:active,
.buy-button:active {
  background: #222;
}

/* ── Footer ────────────────────────────────────────────────── */
footer {
  background: #333;
  color: #fff;
  padding: 10px;
  text-align: center;
  border-radius: 10px;
  margin-top: 20px;
}

/* ── Subcategory grid ──────────────────────────────────────── */
.subcategory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.subcategory-item {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.subcategory-item img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.view-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 8px 14px;
  min-height: 36px;
  background: #007bff;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.85rem;
}
