/* Media Library — KARST ad-creative gallery. Mirrors the trykarst AdGallery:
   labeled sections → clickable concept folders → drill-down modal of variants.
   Inherits the navy/cyan chrome (topbar, container, toolbar, search) from
   styles.css; everything below is additive. Navy #0B1D28 + cyan #7FE3F5. */

.lib-intro {
  color: var(--ink-soft);
  font-size: 13px;
  margin: 2px 0 8px;
}

/* ── section band ─────────────────────────────────────────────────────────── */
.lib-section {
  margin: 26px 0;
  border: 1px solid #CDE8F0;
  background: #FBFDFE;
  border-radius: 18px;
  padding: 18px 18px 22px;
}
.lib-section.is-hidden { display: none; }

.sec-head { margin-bottom: 14px; }
.sec-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.2px;
}
.sec-glyph { color: var(--cyan-deep); font-size: 14px; }
.sec-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan-deep);
  background: #E3F6FB;
  border-radius: 999px;
  padding: 2px 9px;
}
.sec-desc {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.sec-desc b { color: var(--cyan-deep); font-weight: 600; }

/* ── tile grids ───────────────────────────────────────────────────────────── */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 14px;
}

/* one folder / brand tile */
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(11, 29, 40, 0.13);
  border-color: var(--cyan-deep);
}
.tile:focus-visible { outline: 2px solid var(--cyan-deep); outline-offset: 2px; }
.tile.is-hidden { display: none; }

.tile-thumb {
  position: relative;
  background: var(--navy);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile-thumb.ratio { aspect-ratio: 9 / 16; }
.tile-thumb.square { aspect-ratio: 1 / 1; }
.tile-thumb img {
  width: 100%;
  height: 100%;
  display: block;
}
.tile-thumb.cover img { object-fit: cover; }
.tile-thumb.contain img { object-fit: contain; }
.tile:hover .tile-thumb.cover img { transform: scale(1.04); transition: transform 0.2s ease; }

.tile-cap {
  display: block;
  padding: 9px 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* badges floating on the thumbnail */
.badge {
  position: absolute;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1;
}
.badge-star { top: 8px; left: 8px; background: var(--cyan); color: var(--navy); }
.badge-group { top: 8px; right: 8px; background: rgba(11, 29, 40, 0.82); color: #DCEef4; text-transform: lowercase; }
.badge-count { bottom: 8px; right: 8px; background: rgba(11, 29, 40, 0.82); color: var(--cyan); }

/* ── drill-down modal ─────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(11, 29, 40, 0.92);
  backdrop-filter: blur(3px);
  overflow: auto;
  padding: 28px 18px;
}
.modal-card {
  max-width: 1040px;
  margin: 0 auto;
}
.modal-head {
  position: sticky;
  top: -28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px;
  margin-bottom: 8px;
  background: rgba(11, 29, 40, 0.92);
}
.modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--cyan);
}
.modal-title .modal-sub { color: #9FB4BD; font-weight: 500; }
.modal-close {
  flex: none;
  background: transparent;
  border: 1px solid rgba(127, 227, 245, 0.4);
  color: #C7D6DD;
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.modal-close:hover { color: #fff; border-color: var(--cyan); }

.modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.shot {
  position: relative;
  margin: 0;
  background: #0E2531;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
}
.shot.is-base { border-color: rgba(127, 227, 245, 0.45); }
.shot a {
  display: block;
  background: var(--navy);
}
.shot-thumb { display: block; }
.shot.ratio .shot-thumb { aspect-ratio: 9 / 16; }
.shot.square .shot-thumb { aspect-ratio: 1 / 1; }
.shot-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.shot figcaption {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: 11.5px;
  color: #C7D6DD;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shot .badge-star { position: static; }
.shot .cap-text { overflow: hidden; text-overflow: ellipsis; }
.shot.is-base figcaption { color: var(--cyan); }

@media (max-width: 560px) {
  .folder-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .modal-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
