/**
 * Explore page — Mobile-first, aesthetic experience.
 * Base = small viewport; enhance with min-width media queries.
 */

/* ----- Page shell: safe area, breathing room ----- */
.explore-page .page-content {
  padding-top: var(--app-space-md);
  padding-bottom: calc(var(--app-tabbar-height) + var(--app-space-xl) + var(--app-safe-bottom));
}

/* ----- Hero: title + subtitle ----- */
.explore-page .page-title {
  font-size: clamp(1.5rem, 5vw, 1.875rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.2;
  margin-bottom: var(--app-space-sm);
  background: var(--app-gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.explore-page .page-subtitle {
  font-size: clamp(0.9375rem, 2vw, 1rem);
  line-height: 1.55;
  color: var(--app-text-secondary);
  margin-bottom: var(--app-space-lg);
  max-width: 42ch;
}

/* ----- Search: pill-style, touch-friendly ----- */
.explore-search-wrap {
  margin-bottom: var(--app-space-lg);
  position: relative;
}
.explore-search-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--app-text-secondary);
  margin-bottom: 8px;
}
.explore-search-input {
  width: 100%;
  min-height: 48px;
  padding: 14px 18px 14px 48px;
  font-size: 1rem;
  font-family: var(--app-font);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-full);
  background: var(--app-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23475569' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") no-repeat 18px center;
  background-size: 22px 22px;
  color: var(--app-text);
  box-sizing: border-box;
  transition: border-color var(--app-duration-fast) var(--app-ease), box-shadow var(--app-duration-fast) var(--app-ease);
  -webkit-tap-highlight-color: transparent;
}
.explore-search-input::placeholder {
  color: var(--app-text-muted);
}
.explore-search-input:focus {
  outline: none;
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px var(--app-primary-soft);
}
.explore-search-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--app-text-muted);
  margin-top: 8px;
}
.explore-search-no-results {
  padding: var(--app-space-xl);
  text-align: center;
  color: var(--app-text-secondary);
  display: none;
}
.explore-search-no-results.visible {
  display: block;
}

/* ----- Free to try hero ----- */
.explore-free-hero {
  margin-bottom: var(--app-space-xl);
  padding: var(--app-space-lg) 0;
}
.explore-free-hero-title {
  font-size: clamp(1.125rem, 3vw, 1.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--app-text);
  margin: 0 0 4px 0;
}
.explore-free-hero-sub {
  font-size: var(--app-text-sm);
  color: var(--app-text-muted);
  margin: 0 0 var(--app-space-lg) 0;
}
/* Mobile: single column, full-width cards */
.explore-free-hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--app-space-md);
}
.explore-free-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--app-space-lg);
  border-radius: var(--app-radius-lg);
  text-decoration: none;
  color: var(--app-text);
  border: 1px solid var(--app-border-soft);
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
  transition: transform var(--app-duration) var(--app-ease-out), box-shadow var(--app-duration) var(--app-ease), border-color var(--app-duration) var(--app-ease);
  min-height: 0;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.explore-free-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--app-gradient-soft);
  opacity: 0;
  transition: opacity var(--app-duration) var(--app-ease);
}
.explore-free-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--app-shadow-lg), 0 8px 24px -4px rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.25);
}
.explore-free-card:hover::before {
  opacity: 1;
}
.explore-free-card:active {
  transform: translateY(-2px);
}
.explore-free-card-icon {
  display: block;
  margin-bottom: 14px;
  border-radius: var(--app-radius-md);
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.08));
  position: relative;
  z-index: 1;
}
.explore-free-card-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--app-primary);
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}
.explore-free-card-title {
  font-size: var(--app-text-base);
  font-weight: 700;
  color: var(--app-text);
  margin-bottom: 6px;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}
.explore-free-card-desc {
  font-size: var(--app-text-sm);
  color: var(--app-text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
  flex: 1;
  position: relative;
  z-index: 1;
}
.explore-free-card-cta {
  font-size: var(--app-text-sm);
  font-weight: 600;
  color: var(--app-primary);
  margin-top: auto;
  position: relative;
  z-index: 1;
}
.explore-free-card-mocks {
  background: linear-gradient(145deg, var(--app-surface) 0%, rgba(99, 102, 241, 0.05) 100%);
}
.explore-free-card-personality {
  background: linear-gradient(145deg, var(--app-surface) 0%, rgba(139, 92, 246, 0.06) 100%);
}
.explore-free-card-personality .explore-free-card-label {
  color: #7c3aed;
}
.explore-free-card-personality:hover .explore-free-card-cta {
  color: #6d28d9;
}
.explore-free-card-jobs {
  background: linear-gradient(145deg, var(--app-surface) 0%, rgba(16, 185, 129, 0.06) 100%);
}
.explore-free-card-jobs .explore-free-card-label {
  color: var(--app-success);
}
.explore-free-card-jobs:hover .explore-free-card-cta {
  color: var(--app-success);
}

/* ----- Category sections ----- */
.explore-category {
  margin-bottom: var(--app-space-xl);
}
.explore-category:last-child {
  margin-bottom: 0;
}
.explore-category-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--app-text-secondary);
  margin: 0 0 var(--app-space-md);
  padding: 0 0 var(--app-space-xs);
  line-height: 1.3;
  border-bottom: 2px solid var(--app-primary-soft);
  display: inline-block;
}
.explore-category:first-of-type {
  margin-top: var(--app-space-md);
}
.explore-category + .explore-category {
  padding-top: var(--app-space-lg);
  border-top: 1px solid var(--app-border-soft);
}
.explore-category + .explore-category .explore-category-title {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* ----- Tiles grid: mobile-first (1 col on tiny screens, then 2 cols) ----- */
.explore-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0;
}
@media (min-width: 360px) {
  .explore-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.explore-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: var(--app-space-md) var(--app-space-sm);
  min-height: 120px;
  min-width: 0;
  background: var(--app-surface);
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-border-soft);
  text-decoration: none;
  color: var(--app-text);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--app-duration) var(--app-ease-out), box-shadow var(--app-duration) var(--app-ease), border-color var(--app-duration) var(--app-ease);
  box-shadow: var(--app-shadow);
  position: relative;
  overflow: hidden;
}
.explore-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--app-gradient-soft);
  opacity: 0;
  transition: opacity var(--app-duration) var(--app-ease);
}
.explore-tile:hover {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: var(--app-shadow-card);
  transform: translateY(-3px);
}
.explore-tile:hover::before {
  opacity: 1;
}
.explore-tile:active {
  transform: translateY(-1px);
}
.explore-tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--app-radius-md);
  background: var(--app-gradient-soft);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  transition: transform var(--app-duration) var(--app-ease-out), box-shadow var(--app-duration) var(--app-ease);
}
.explore-tile:hover .explore-tile-icon {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}
.explore-tile-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.explore-tile-icon-avatar img {
  object-fit: cover;
  border-radius: inherit;
}
.explore-tile-desc {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--app-text-secondary);
  line-height: 1.35;
  position: relative;
  z-index: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.explore-tile span:not(.explore-tile-icon):not(.explore-tile-desc) {
  position: relative;
  z-index: 1;
  line-height: 1.25;
}

/* View all (expand) */
.explore-tile-more {
  display: none !important;
}
.explore-grid.expanded .explore-tile-more {
  display: flex !important;
}
.explore-view-all-wrap {
  margin-top: var(--app-space-sm);
  grid-column: 1 / -1;
}
.explore-view-all-btn {
  width: 100%;
  min-height: 48px;
  padding: 14px var(--app-space-md);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--app-font);
  color: var(--app-primary);
  background: var(--app-surface);
  border: 2px solid var(--app-primary);
  border-radius: var(--app-radius-lg);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--app-duration-fast) var(--app-ease), color var(--app-duration-fast) var(--app-ease), transform var(--app-duration-fast) var(--app-ease);
}
.explore-view-all-btn:hover {
  background: var(--app-primary-soft);
}
.explore-view-all-btn:active {
  transform: scale(0.98);
}
.explore-grid.expanded .explore-view-all-wrap {
  display: none !important;
}

/* ----- 480px: free hero 2 cols ----- */
@media (min-width: 480px) {
  .explore-free-hero-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--app-space);
  }
  .explore-free-card {
    min-height: 160px;
  }
  .explore-grid {
    gap: 14px;
  }
  .explore-tile {
    padding: var(--app-space-lg) var(--app-space-md);
    min-height: 128px;
  }
  .explore-tile-icon {
    width: 56px;
    height: 56px;
  }
  .explore-tile-desc {
    font-size: 0.75rem;
    -webkit-line-clamp: 2;
  }
}

/* ----- 600px: 3-col tiles, more padding ----- */
@media (min-width: 600px) {
  .explore-page .page-content {
    padding-bottom: calc(var(--app-tabbar-height) + var(--app-space-xl) + var(--app-safe-bottom));
  }
  .explore-free-hero-grid {
    gap: var(--app-space-lg);
  }
  .explore-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
  .explore-tile {
    padding: 20px 16px;
    min-height: 132px;
    font-size: 0.9375rem;
  }
  .explore-tile-desc {
    display: -webkit-box;
    font-size: 0.8125rem;
  }
}

/* ----- 720px: free hero 3 cols ----- */
@media (min-width: 720px) {
  .explore-free-hero-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .explore-free-card {
    min-height: 180px;
  }
}

/* ----- 768px: section spacing, larger type ----- */
@media (min-width: 768px) {
  .explore-page .page-title {
    letter-spacing: -0.045em;
  }
  .explore-page .page-subtitle {
    max-width: 48ch;
  }
  .explore-category + .explore-category {
    padding-top: var(--app-space-xl);
  }
  .explore-category-title {
    font-size: 0.875rem;
  }
}

/* ----- 1024px: 4-col grid, max-width, polish ----- */
@media (min-width: 1024px) {
  .explore-page .page-content {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    padding-bottom: calc(var(--app-tabbar-height) + 48px + var(--app-safe-bottom));
  }
  .explore-free-hero {
    margin-bottom: var(--app-space-xl);
  }
  .explore-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    max-width: 100%;
  }
  .explore-tile {
    padding: 24px 18px;
    min-height: 140px;
    font-size: 1rem;
  }
  .explore-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--app-shadow-card-hover), 0 8px 28px -8px rgba(99, 102, 241, 0.2);
  }
  .explore-tile-icon {
    width: 60px;
    height: 60px;
  }
  .explore-tile-desc {
    font-size: 0.8125rem;
    -webkit-line-clamp: 2;
  }
}

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
  .explore-free-card,
  .explore-tile {
    transition: none;
  }
  .explore-tile:hover {
    transform: none;
  }
  .explore-tile:hover .explore-tile-icon {
    transform: none;
  }
}
