:root {
  --brand: #4746e5;
  --brand-dark: #3634c4;
  --brand-light: #ecebff;
  --ink: #1d2129;
  --ink-soft: #5c6470;
  --line: #e7e9ee;
  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(20, 24, 40, 0.08);
  --shadow-hover: 0 12px 34px rgba(71, 70, 229, 0.18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Top bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.5px;
}
.logo-mark {
  color: var(--brand);
  font-size: 24px;
}
.mainnav {
  display: flex;
  gap: 22px;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink-soft);
}
.mainnav a { transition: color .15s; }
.mainnav a:hover { color: var(--brand); }
.mainnav a.active { color: var(--ink); }
.caret { font-size: 11px; }

/* "More" dropdown */
.nav-dropdown { position: relative; }
.nav-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: -8px;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px 0;
  z-index: 60;
}
.nav-dropdown.open .nav-menu { display: block; }
.nav-menu a {
  display: block;
  padding: 10px 18px;
  font-size: 14px;
  white-space: nowrap;
}
.nav-menu a:hover { background: var(--brand-light); color: var(--brand-dark); }
.nav-menu a.active { color: var(--brand); }
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-ghost, .btn-primary {
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
  border: 0;
  transition: transform .12s, background .15s, box-shadow .15s;
}
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); box-shadow: var(--shadow-hover); }
.btn-primary:active, .btn-ghost:active { transform: translateY(1px); }

/* ===== Hero / Search ===== */
.hero {
  background: linear-gradient(135deg, #4746e5 0%, #6d5cf0 50%, #8b5cf6 100%);
  padding: 52px 24px 60px;
  color: #fff;
}
.hero-inner { max-width: 760px; margin: 0 auto; text-align: center; }
.searchbar {
  display: flex;
  align-items: stretch;
  background: #fff;
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(20, 20, 60, 0.25);
}
.search-scope {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  padding: 0 14px;
  border-right: 1px solid var(--line);
  cursor: pointer;
  outline: none;
}
.search-input {
  flex: 1;
  border: 0;
  outline: none;
  font-family: inherit;
  font-size: 17px;
  padding: 14px 16px;
  color: var(--ink);
  background: transparent;
}
.search-btn {
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 10px;
  width: 56px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s;
}
.search-btn:hover { background: var(--brand-dark); }
.hero-suggest {
  margin: 18px 0 0;
  font-size: 14px;
  opacity: .92;
}
.hero-suggest a {
  text-decoration: underline;
  margin: 0 4px;
  opacity: .95;
}
.hero-suggest a:hover { opacity: 1; }

/* ===== Breadcrumb + Title ===== */
.breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 20px 0 6px;
}
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .current { color: var(--ink); font-weight: 700; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 0 22px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0 0 6px;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.8px;
}
.page-sub { margin: 0; color: var(--ink-soft); font-size: 15px; }
.page-head-badges { display: flex; gap: 8px; }
.badge {
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
}

/* ===== Filters ===== */
.filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  flex-wrap: wrap;
}
.filter-group { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.filter-right { display: flex; align-items: center; gap: 18px; }
.source-note {
  display: none;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 700;
}
.source-note strong { color: var(--brand); }
.source-note:hover { color: var(--brand); }
/* In live (Iconify / Flaticon) mode, results are mixed styles — the
   local style chips don't apply, so hide them and show attribution +
   (for Iconify) the icon-set filter instead. */
body[data-source="iconify"] #style-filters,
body[data-source="flaticon"] #style-filters { display: none; }
body[data-source="iconify"] .source-note--iconify { display: inline-flex; }
body[data-source="flaticon"] .source-note--fi { display: inline-flex; }
#set-label { display: none; }
body[data-source="iconify"] #set-label { display: inline-flex; }

.sort-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#sort-select, #set-select {
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
#set-select { max-width: 200px; text-overflow: ellipsis; }

/* ===== Icon grid ===== */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  padding: 8px 0 8px;
  min-height: 200px;
}
.icon-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: transform .16s, box-shadow .16s, border-color .16s;
  animation: pop .32s ease both;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.icon-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--brand);
}
.icon-card .art {
  width: 56px;
  height: 56px;
  color: var(--ink);
  transition: color .16s, transform .16s;
}
.icon-card:hover .art { color: var(--brand); transform: scale(1.06); }
.icon-card .art svg { width: 100%; height: 100%; display: block; }
.icon-card .art img { width: 100%; height: 100%; object-fit: contain; display: block; }
.icon-card .art-loading {
  border-radius: 10px;
  background: var(--bg-soft);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }

/* loading skeletons */
.icon-card.skeleton {
  cursor: default;
  animation: none;
  background: var(--bg-soft);
  border-color: var(--line);
}
.icon-card.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.65) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: shimmer 1.1s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.icon-card .label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 0 8px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* hover download bar */
.icon-card .dl-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  transform: translateY(100%);
  transition: transform .18s ease;
}
.icon-card:hover .dl-bar { transform: translateY(0); }
.dl-bar button {
  flex: 1;
  border: 0;
  padding: 9px 0;
  font-family: inherit;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .3px;
  cursor: pointer;
  color: #fff;
  background: var(--brand);
  transition: background .12s;
}
.dl-bar button:hover { background: var(--brand-dark); }
.dl-bar button + button { border-left: 1px solid rgba(255,255,255,.25); }

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  font-size: 16px;
  padding: 60px 0;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 28px 0 12px;
  flex-wrap: wrap;
}
.pagination button {
  min-width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: all .14s;
}
.pagination button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pagination button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ===== Related ===== */
.related { padding: 40px 24px 20px; }
.related h2 { font-size: 20px; font-weight: 900; margin: 0 0 16px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-cloud a {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  transition: all .15s;
}
.tag-cloud a:hover { background: var(--brand-light); color: var(--brand-dark); border-color: var(--brand-light); }

/* ===== Footer ===== */
.footer {
  margin-top: 40px;
  background: #12141c;
  color: #c4c9d4;
  padding: 48px 0 24px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
}
.logo--light { color: #fff; }
.footer-blurb { margin: 12px 0 0; font-size: 14px; max-width: 300px; line-height: 1.6; color: #99a0ae; }
.footer h4 { color: #fff; font-size: 15px; margin: 0 0 14px; }
.footer-grid a { display: block; font-size: 14px; padding: 5px 0; color: #99a0ae; transition: color .14s; }
.footer-grid a:hover { color: #fff; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid #262a36;
  font-size: 13px;
  color: #767d8c;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 17, 24, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative;
  background: #fff;
  border-radius: 16px;
  max-width: 680px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 32px 36px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  animation: pop .25s ease;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-size: 15px;
  cursor: pointer;
  transition: background .14s;
}
.modal-close:hover { background: var(--line); }
.modal h2 { margin: 0 0 12px; font-size: 24px; font-weight: 900; letter-spacing: -.4px; }
.modal h3 { font-size: 16px; margin: 20px 0 6px; }
.modal p, .modal li { font-size: 14.5px; line-height: 1.7; color: var(--ink-soft); }
.modal ul { padding-left: 20px; margin: 8px 0; }
.modal .post { padding: 12px 0; border-bottom: 1px solid var(--line); }
.modal .post:last-child { border-bottom: 0; }
.modal .post-date { font-size: 12px; color: var(--ink-soft); }
.modal .post h3 { margin: 2px 0 4px; }

/* collections browser inside the modal */
.coll-cat {
  font-weight: 900;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--ink);
  margin: 20px 0 8px;
}
.collection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.collection-grid button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: all .13s;
}
.collection-grid button:hover { border-color: var(--brand); color: var(--brand); }
.coll-count { color: var(--ink-soft); font-weight: 400; font-size: 12px; white-space: nowrap; }
@media (max-width: 560px) {
  .collection-grid { grid-template-columns: 1fr; }
  .modal { padding: 26px 22px; }
}

/* auth modal form */
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.auth-form input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.auth-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.auth-submit {
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  background: var(--brand);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.auth-submit:hover { background: var(--brand-dark); box-shadow: var(--shadow-hover); }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
  margin: 2px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--ink);
  cursor: pointer;
  transition: background .14s, border-color .14s, box-shadow .14s;
}
.google-btn:hover {
  background: var(--bg-soft);
  border-color: #c9cdd6;
  box-shadow: 0 2px 10px rgba(20, 24, 40, .08);
}
#google-btn-slot { display: flex; justify-content: center; }

/* demo Google account picker */
.gpicker { display: flex; flex-direction: column; gap: 6px; }
.gpicker-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.gpicker h2 { margin: 0; }
.gpicker-sub { margin: 0 0 14px; }
.gaccount {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .13s, border-color .13s;
}
.gaccount:hover { background: var(--bg-soft); border-color: #c9cdd6; }
.gavatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 16px;
  flex-shrink: 0;
}
.gwho { display: flex; flex-direction: column; gap: 1px; }
.gwho strong { font-size: 14.5px; color: var(--ink); }
.gwho small { font-size: 12.5px; color: var(--ink-soft); }

.auth-alt { font-size: 13.5px; text-align: center; margin: 4px 0 0; }
.auth-alt a { color: var(--brand); font-weight: 700; cursor: pointer; }
.auth-note { font-size: 12px; color: var(--ink-soft); text-align: center; margin: 2px 0 0; }

/* logged-in user chip */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}
.user-chip .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 14px;
}
.user-chip .avatar-img { object-fit: cover; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 120%);
  background: var(--ink);
  color: #fff;
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 100;
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); }

/* ===== Collections directory (home page) ===== */
/* Shown only in "home" mode; the grid + filters take over as soon as
   the user searches or opens a set. */
#collections-home { display: none; padding-top: 4px; }
body[data-source="home"] #collections-home { display: block; }
body[data-source="home"] .filters,
body[data-source="home"] main.container { display: none; }

.coll-home-head h2 { font-size: 20px; font-weight: 900; margin: 18px 0 4px; }
#coll-home-sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 4px; }

/* Wider grid than the modal version */
.collections-home .collection-grid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1020px) {
  .collections-home .collection-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .collections-home .collection-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .collections-home .collection-grid { grid-template-columns: 1fr; }
}

/* ===== Wired-in icon libraries ===== */
/* Lucide logo mark (topbar + footer) */
.logo-mark { display: inline-flex; align-items: center; }
.logo-mark svg { width: 24px; height: 24px; }

/* Font Awesome search glyph */
.search-btn i { font-size: 20px; line-height: 1; }

/* Material Icons "More" caret */
.caret.material-icons {
  font-size: 18px;
  line-height: 1;
  vertical-align: middle;
}

/* Heroicons breadcrumb separators */
.breadcrumb .bc-sep { display: inline-flex; align-items: center; }
.breadcrumb .bc-sep svg { width: 14px; height: 14px; }

/* Lucide modal close */
.modal-close { display: grid; place-items: center; }
.modal-close svg { width: 18px; height: 18px; }

/* Font Awesome "made with ♥" heart */
.made-heart { color: #e5484d; margin: 0 2px; }

/* Flaticon attribution badge (white chip so the PNG shows on dark footer) */
.fi-credit { display: inline-flex; align-items: center; gap: 6px; }
.fi-credit .fi-badge {
  background: #fff;
  border-radius: 4px;
  padding: 2px;
  vertical-align: middle;
}
.fi-credit a { text-decoration: underline; }
.fi-credit a:hover { color: #fff; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .mainnav { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .page-head h1 { font-size: 28px; }
}
@media (max-width: 560px) {
  .search-scope { display: none; }
  .icon-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; }
}
