/* CTkMaker Hub — dark theme matching the builder's chrome. */

:root {
  --bg: #1e1e1e;
  --panel: #252526;
  --panel-2: #2d2d30;
  --border: #3c3c3c;
  --text: #cccccc;
  --text-muted: #888888;
  --text-strong: #ffffff;
  --accent: #5bc0f8;
  --accent-hover: #7dd3fc;
  --tag: #094771;
  --tag-text: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { color: var(--accent-hover); }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.brand:hover .brand-text h1 { color: var(--accent); }

.brand-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: 0.2px;
  transition: color 0.15s ease;
}

.brand-text .tagline {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.topnav {
  display: flex;
  gap: 4px;
  margin-left: 16px;
}
.topnav a {
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
}
.topnav a:hover {
  background: var(--panel-2);
  color: var(--text-strong);
}
.topnav a.active {
  background: var(--panel-2);
  color: var(--accent);
  font-weight: 600;
}
.topnav a.coffee-link {
  background: #ffdd00;
  color: #2a1a05;
  font-weight: 600;
}
.topnav a.coffee-link:hover {
  background: #ffe43a;
  color: #2a1a05;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: auto;
}

@media (max-width: 800px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding: 14px 20px; }
  .topnav { margin-left: 0; }
  .topbar-actions { margin-left: 0; }
}

.github-link {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  background: var(--panel-2);
}
.github-link:hover {
  background: var(--border);
  color: var(--text-strong);
}

.upload-btn {
  padding: 8px 16px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #0a0a0a;
}
.upload-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #0a0a0a;
}

.notice {
  margin: 0;
  padding: 8px 32px;
  background: #d4ac62;
  color: #2a1a05;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}
.notice strong {
  color: #1a0f00;
  margin-right: 2px;
}

.controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
}

.search {
  flex: 1 1 240px;
  min-width: 240px;
  max-width: 360px;
  padding: 8px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.search:focus {
  border-color: var(--accent);
}

.sort {
  padding: 8px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
.sort:focus { border-color: var(--accent); }

.categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cat-btn {
  padding: 6px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  text-transform: capitalize;
}
.cat-btn:hover { background: var(--border); }
.cat-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0a0a;
  font-weight: 600;
}

.category-desc {
  margin: 0;
  padding: 14px 32px 0 32px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  font-style: italic;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  padding: 24px 32px;
}

.loading, .empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
  font-size: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease;
}
.card:hover {
  border-color: var(--accent);
}

.card .preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  background-color: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  /* "contain" keeps the whole screenshot visible — submitters use a
     mix of aspect ratios, and "cover" was clipping vertical UIs.
     Padding may show on extreme ratios, that's the trade-off. */
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  cursor: zoom-in;
}
.card .preview[data-empty="true"] {
  cursor: default;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
  padding: 8px 12px;
  opacity: 0.8;
}
.lightbox-close:hover { opacity: 1; }

.card .body {
  padding: 12px 14px 14px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card .author-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.card .license-sig {
  color: var(--text-muted);
  opacity: 0.75;
}

.card .details {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-muted);
}

.card .detail {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card .detail.tag {
  text-transform: capitalize;
  color: var(--accent);
}

.card .details.social {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 2px;
}

.card .discuss-link {
  margin-left: auto;
  color: var(--accent);
}
.card .discuss-link:hover { color: var(--accent-hover); }

.card .icon {
  width: 14px;
  height: 14px;
  opacity: 0.75;
  flex-shrink: 0;
}
.card .name .icon { width: 16px; height: 16px; opacity: 0.9; }

.card .description {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  /* Clamp to 3 lines so cards stay even-height. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .download {
  margin-top: auto;
  padding: 8px 12px;
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.card .download:hover { background: var(--accent-hover); }

.footer {
  padding: 24px 32px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ---------- Landing page ---------- */

.hero {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 48px;
  align-items: center;
  padding: 64px 32px 56px 32px;
  border-bottom: 1px solid var(--border);
}

.hero-badge {
  display: inline-block;
  margin: 0 0 14px 0;
  padding: 4px 12px;
  background: rgba(91, 192, 248, 0.12);
  border: 1px solid var(--accent);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.hero-text h2 {
  margin: 0 0 16px 0;
  font-size: 38px;
  line-height: 1.15;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.5px;
}

.hero-fineprint {
  margin: 14px 0 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.hero-sub {
  margin: 0 0 28px 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  max-width: 520px;
}

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.cta {
  padding: 12px 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
}
.cta.primary {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
}
.cta.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #0a0a0a;
}
.cta.secondary {
  background: var(--panel-2);
  color: var(--text-strong);
  border-color: var(--border);
}
.cta.secondary:hover {
  background: var(--panel);
  border-color: var(--accent);
  color: var(--accent);
}

.hero-media {
  position: relative;
}

.carousel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
}

.carousel-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.carousel-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--panel-2);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.carousel-slide.active { opacity: 1; }

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.carousel-nav:hover { background: rgba(0, 0, 0, 0.8); }
.carousel-nav.prev { left: 10px; }
.carousel-nav.next { right: 10px; }

.carousel-dots {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 2;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease;
}
.carousel-dot:hover { background: rgba(255, 255, 255, 0.7); }
.carousel-dot.active { background: var(--accent); }

.section {
  padding: 56px 32px;
  border-bottom: 1px solid var(--border);
  max-width: 1100px;
  margin: 0 auto;
}
.section-alt {
  background: var(--panel);
  max-width: none;
  margin: 0;
}

.section-cta {
  background: linear-gradient(180deg, rgba(91, 192, 248, 0.06), transparent);
  border-left: 3px solid var(--accent);
  padding-left: 29px;
}
.section-cta .cta-card {
  border-color: var(--accent);
  background: var(--panel);
}
.section-cta .cta-card:hover {
  background: var(--panel-2);
  border-color: var(--accent-hover);
}

.section-title {
  margin: 0 0 12px 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-strong);
}

.section-lead {
  margin: 0 0 28px 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  max-width: 720px;
}
.section-lead code,
.feature p code {
  background: var(--panel-2);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
  border: 1px solid var(--border);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.feature {
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.section-alt .feature { background: var(--panel-2); }

.feature h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}
.feature p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.video-wrap {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-note {
  margin: 12px 0 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.hub-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.hub-card {
  display: block;
  padding: 22px 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.hub-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.hub-card h4 {
  margin: 0 0 6px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}
.hub-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.steps {
  margin: 0 0 24px 0;
  padding: 0 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
}
.steps li {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.steps li strong {
  color: var(--text-strong);
}

.steps-foot {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  max-width: 720px;
}

@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 40px 20px;
  }
  .hero-text h2 { font-size: 28px; }
  .section { padding: 40px 20px; }
}
