/**
 * Theme card component — single source for archive, front-page, Elementor widget.
 * Markup: gt_theme_card() in includes/theme-card.php
 */

/* ── Grid ── */
.gt-themes-grid {
  display: grid;
  gap: 1.5rem;
  --gt-grid-cols: 1;
  grid-template-columns: repeat(var(--gt-grid-cols), minmax(0, 1fr));
}

.gt-themes-grid--2 { --gt-grid-cols: 2; }
.gt-themes-grid--3 { --gt-grid-cols: 3; }
.gt-themes-grid--4 { --gt-grid-cols: 4; }

@media (max-width: 639px) {
  .gt-themes-grid--2,
  .gt-themes-grid--3,
  .gt-themes-grid--4 {
    --gt-grid-cols: 1;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .gt-themes-grid--3 { --gt-grid-cols: 2; }
  .gt-themes-grid--4 { --gt-grid-cols: 2; }
}

.gt-themes-grid > .theme-card {
  height: 100%;
  min-width: 0;
}

[data-gt-themes-archive] [data-gt-archive-card].gt-archive-card--hidden,
body:not(.wp-admin) [data-gt-themes-archive] .gt-themes-grid > .theme-card.gt-archive-card--hidden,
body:not(.wp-admin) [data-gt-themes-archive] .gt-themes-archive-list > .gt-archive-card--hidden {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  pointer-events: none !important;
}

[data-gt-themes-archive]:not([data-gt-alpine-ready]) .gt-themes-archive-list {
  display: none !important;
}

/* Archive pagination — card fade + loader */
[data-gt-themes-archive] [data-gt-archive-card],
[data-gt-themes-archive] .gt-themes-grid > .theme-card {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

[data-gt-themes-archive].gt-archive--loading [data-gt-archive-card]:not(.gt-archive-card--hidden),
[data-gt-themes-archive].gt-archive--loading .gt-themes-grid > .theme-card:not(.gt-archive-card--hidden) {
  opacity: 0.4;
  transform: translateY(6px);
  pointer-events: none;
}

.gt-archive-loader {
  position: relative;
  width: 2.75rem;
  height: 2.75rem;
}

.gt-archive-loader__ring {
  position: absolute;
  inset: 0;
  border: 3px solid color-mix(in srgb, var(--gt-primary, #5233eb) 18%, transparent);
  border-top-color: var(--gt-primary, #5233eb);
  border-radius: 50%;
  animation: gt-archive-spin 0.75s linear infinite;
}

.gt-archive-loader__dot {
  position: absolute;
  inset: 0.65rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gt-primary, #5233eb), var(--gt-secondary, #7c3aed));
  opacity: 0.85;
  animation: gt-archive-pulse 1.1s ease-in-out infinite;
}

@keyframes gt-archive-spin {
  to { transform: rotate(360deg); }
}

@keyframes gt-archive-pulse {
  0%, 100% { transform: scale(0.88); opacity: 0.65; }
  50% { transform: scale(1); opacity: 1; }
}

.gt-el-theme-listing-wrap .gt-themes-grid,
.elementor-widget-gt-theme-listing .gt-themes-grid {
  align-items: stretch;
}

.gt-el-theme-listing-wrap .theme-card,
.elementor-widget-gt-theme-listing .theme-card {
  height: 100%;
  font-family: var(--gt-font, 'Outfit', system-ui, sans-serif);
}

/* ── Card shell ── */
.theme-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--gt-border-light, #f1f5f9);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
  transition:
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.theme-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1), 0 24px 48px rgba(0, 0, 0, 0.06);
}

/* ── Media ── */
.theme-card__media {
  position: relative;
  flex-shrink: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--gt-bg-subtle, #f1f5f9);
}

.theme-card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
  border-radius: 0;
  box-shadow: none;
  max-width: none;
  transition: transform 0.4s ease;
}

.theme-card:hover .theme-card__img {
  transform: scale(1.04);
}

.theme-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

.theme-card__placeholder-chrome {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}

.theme-card__placeholder-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.3);
}

.theme-card__placeholder-bars {
  display: flex;
  gap: 0.25rem;
}

.theme-card__placeholder-bar {
  width: 2rem;
  height: 0.625rem;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.2);
}

.theme-card__placeholder-pill {
  margin-left: auto;
  width: 3rem;
  height: 1.25rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
}

.theme-card__placeholder-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-card__placeholder-lines {
  text-align: center;
}

.theme-card__placeholder-line {
  height: 1rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.25);
  width: 8rem;
  margin: 0 auto 0.5rem;
}

.theme-card__placeholder-line--sm {
  height: 0.625rem;
  width: 5rem;
  background: rgba(255, 255, 255, 0.15);
  margin-bottom: 0;
}

.theme-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(10, 8, 24, 0.75);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.theme-card:hover .theme-card-overlay {
  opacity: 1;
}

.theme-card__badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}

.theme-card__demos {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

/* ── Body ── */
.theme-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1rem 1.25rem 1.25rem;
  min-height: 0;
}

.theme-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.theme-card__head-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.theme-card__title {
  margin: 0;
  font-family: var(--gt-font-display, 'Outfit', system-ui, sans-serif);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--gt-text-heading, #0f172a);
}

.theme-card__title-link,
.theme-card__title a {
  color: inherit;
  text-decoration: none !important;
  box-shadow: none !important;
}

.theme-card:hover .theme-card__title-link,
.theme-card:hover .theme-card__title a {
  color: var(--gt-primary, #5233eb);
}

.gt-theme-card-cats {
  display: block;
  margin: 0;
  padding: 0;
  line-height: 1.35;
  font-size: 0.75rem;
}

.theme-card__cat-link,
.gt-theme-card-cats a {
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b !important;
  text-decoration: none !important;
}

.theme-card__cat-link:hover,
.gt-theme-card-cats a:hover {
  color: #334155 !important;
}

.theme-card__cat-sep,
.gt-theme-card-cats span[aria-hidden="true"] {
  font-size: inherit;
  color: #94a3b8;
}

.theme-card__price {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 0.125rem;
}

.theme-card__price-current {
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1;
  color: var(--gt-text-heading, #0f172a);
}

.theme-card__price-original {
  font-size: 0.75rem;
  line-height: 1;
  color: #94a3b8;
  text-decoration: line-through;
}

.theme-card__price-free {
  font-size: 0.75rem;
  font-weight: 600;
  color: #059669;
}

.theme-card__rating {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  text-decoration: none;
  color: inherit;
}

.theme-card__rating:hover {
  opacity: 0.85;
}

.theme-card__stars {
  display: flex;
  color: #f59e0b;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.theme-card__rating-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
}

.theme-card__desc {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #64748b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.theme-card__compat {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-content: flex-start;
}

.theme-card__compat .gt-compat-tag {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
  background: #f1f5f9;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.theme-card__compat .gt-compat-tag:hover {
  background: var(--gt-accent-subtle, #f0edfd);
  color: var(--gt-primary, #5233eb);
}

.theme-card__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.theme-card__actions .gt-btn {
  flex: 1 1 0;
  min-width: 0;
}

/* ── Card buttons (self-contained — no style.min.css required in Elementor) ── */
.theme-card .gt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--gt-radius-lg, 1rem);
  border: 1.5px solid transparent;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), filter 0.38s ease, background 0.22s ease, border-color 0.22s ease, color 0.22s ease;
}

.theme-card .gt-btn--card {
  flex: 1 1 0;
  min-width: 0;
}

.theme-card .gt-btn--outline-neutral {
  background: #fff;
  color: #334155;
  border-color: #e2e8f0;
}

.theme-card .gt-btn--outline-neutral:hover {
  background: #f8fafc;
  border-color: color-mix(in srgb, var(--gt-primary, #5233eb) 35%, transparent);
  color: var(--gt-primary, #5233eb);
}

.theme-card .gt-btn-primary-gradient {
  background: var(--gt-btn-primary-bg, linear-gradient(135deg, #5233eb, #7c3aed));
  color: #fff;
  border-color: transparent;
}

.theme-card .gt-btn-primary-gradient:hover {
  filter: brightness(1.06);
  color: #fff;
  transform: translateY(-2px);
}

.theme-card .gt-btn-outline-light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--gt-btn-radius, 0.75rem);
  padding: 0.4375rem 0.875rem;
  font-size: 0.8125rem;
}

.theme-card .gt-btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

/* ── WP content / Elementor — reset prose styles so cards match /themes/ archive ── */
.gt-wp-content .theme-card,
.article-body .theme-card,
.elementor-widget-gt-theme-listing .theme-card,
.gt-el-theme-listing-wrap .theme-card {
  font-family: var(--gt-font, 'Outfit', system-ui, sans-serif);
  color: var(--gt-text-heading, #0f172a);
}

.gt-wp-content .theme-card h3.theme-card__title,
.article-body .theme-card h3.theme-card__title,
.elementor-widget-gt-theme-listing .theme-card h3.theme-card__title {
  font-family: var(--gt-font-display, 'Outfit', system-ui, sans-serif) !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  color: var(--gt-text-heading, #0f172a) !important;
  margin: 0 !important;
  scroll-margin-top: 0 !important;
}

.gt-wp-content .theme-card p.theme-card__desc,
.article-body .theme-card p.theme-card__desc,
.elementor-widget-gt-theme-listing .theme-card p.theme-card__desc {
  font-size: 0.75rem !important;
  line-height: 1.5 !important;
  color: #64748b !important;
  margin: 0 !important;
}

.gt-wp-content .theme-card img.theme-card__img,
.article-body .theme-card img.theme-card__img,
.elementor-widget-gt-theme-listing .theme-card img.theme-card__img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  object-fit: cover !important;
  box-shadow: none !important;
}

.gt-wp-content .theme-card .gt-theme-card-cats span,
.article-body .theme-card .gt-theme-card-cats span,
.elementor-widget-gt-theme-listing .theme-card .gt-theme-card-cats span {
  font-size: inherit !important;
  line-height: inherit !important;
  margin: 0 !important;
  list-style: none !important;
}

.gt-wp-content .theme-card .gt-btn,
.article-body .theme-card .gt-btn,
.elementor-widget-gt-theme-listing .theme-card .gt-btn {
  margin: 0 !important;
  font-size: 0.75rem !important;
  line-height: 1 !important;
}

/* ── WP content / Elementor page — isolate cards from .article-body link styles ── */
.gt-wp-content .theme-card a,
.article-body .theme-card a,
.elementor-page .theme-card a {
  box-shadow: none !important;
}

.gt-wp-content .theme-card__title-link,
.article-body .theme-card__title-link,
.elementor-page .theme-card__title-link {
  color: #0f172a !important;
  text-decoration: none !important;
}

.gt-wp-content .theme-card:hover .theme-card__title-link,
.article-body .theme-card:hover .theme-card__title-link,
.elementor-page .theme-card:hover .theme-card__title-link {
  color: var(--gt-primary, #5233eb) !important;
}

.gt-wp-content .theme-card__cat-link,
.article-body .theme-card__cat-link,
.elementor-page .theme-card__cat-link,
.gt-wp-content .theme-card .gt-theme-card-cats a,
.article-body .theme-card .gt-theme-card-cats a,
.elementor-page .theme-card .gt-theme-card-cats a {
  color: #64748b !important;
  text-decoration: none !important;
}

.gt-wp-content .theme-card__cat-link:hover,
.article-body .theme-card__cat-link:hover,
.elementor-page .theme-card__cat-link:hover,
.gt-wp-content .theme-card .gt-theme-card-cats a:hover,
.article-body .theme-card .gt-theme-card-cats a:hover,
.elementor-page .theme-card .gt-theme-card-cats a:hover {
  color: #334155 !important;
}

/* ── Elementor kit overrides (links/titles must match archive) ── */
.gt-el-theme-listing-wrap .gt-themes-grid,
.elementor-widget-gt-theme-listing .gt-themes-grid,
.gt-wp-content .gt-themes-grid,
.article-body .gt-themes-grid {
  display: grid !important;
  grid-template-columns: repeat(var(--gt-grid-cols, 1), minmax(0, 1fr)) !important;
  align-items: stretch !important;
}

.gt-el-theme-listing-wrap .gt-themes-grid > .theme-card,
.elementor-widget-gt-theme-listing .gt-themes-grid > .theme-card,
.gt-wp-content .gt-themes-grid > .theme-card,
.article-body .gt-themes-grid > .theme-card {
  align-self: stretch !important;
  min-height: 100%;
}

.gt-el-theme-listing-wrap .theme-card img,
.elementor-widget-gt-theme-listing .theme-card img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover;
}

.gt-el-theme-listing-wrap .theme-card__title a,
.elementor-widget-gt-theme-listing .theme-card__title a {
  color: #0f172a !important;
  text-decoration: none !important;
  box-shadow: none !important;
}

.gt-el-theme-listing-wrap .theme-card:hover .theme-card__title a,
.elementor-widget-gt-theme-listing .theme-card:hover .theme-card__title a {
  color: var(--gt-primary, #5233eb) !important;
}

.gt-el-theme-listing-wrap .gt-theme-card-cats a,
.elementor-widget-gt-theme-listing .gt-theme-card-cats a {
  color: #64748b !important;
  text-decoration: none !important;
  font-size: 0.75rem;
  font-weight: 500;
}

.gt-el-theme-listing-wrap .gt-theme-card-cats a:hover,
.elementor-widget-gt-theme-listing .gt-theme-card-cats a:hover {
  color: #334155 !important;
}

.gt-el-theme-listing-wrap .theme-card__rating,
.elementor-widget-gt-theme-listing .theme-card__rating {
  text-decoration: none !important;
  color: inherit !important;
}

.gt-el-theme-listing-wrap .theme-card__compat a,
.elementor-widget-gt-theme-listing .theme-card__compat a {
  text-decoration: none !important;
}

.gt-el-theme-listing-wrap .theme-card .gt-btn,
.elementor-widget-gt-theme-listing .theme-card .gt-btn {
  text-decoration: none !important;
  box-shadow: none !important;
}

.gt-el-theme-listing-wrap .theme-card h3,
.elementor-widget-gt-theme-listing .theme-card h3 {
  margin: 0;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}

.gt-el-theme-listing-wrap .theme-card p,
.elementor-widget-gt-theme-listing .theme-card p {
  margin-top: 0;
}

/* No reserved height on category / compat rows (override legacy min-height rules). */
.gt-theme-card-cats,
.theme-card__compat,
.gt-el-theme-listing-wrap .gt-theme-card-cats,
.gt-el-theme-listing-wrap .theme-card__compat,
.elementor-widget-gt-theme-listing .gt-theme-card-cats,
.elementor-widget-gt-theme-listing .theme-card__compat {
  min-height: unset !important;
  height: auto;
}
