/* ============================================================
   Explore — search, author header and the public arbox cards
   (.explore-card, also shown on the welcome page).
   Cards match the home grid (home.css): 16:10 cover, glass
   surface, 2-line description, lift on hover.
   ============================================================ */

.explore-main {
  padding: 28px 32px 48px;
}

.explore-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1480px;
  margin-inline: auto;
}

/* ── Head ─────────────────────────────────────────────────────── */

.explore-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}

.explore-head-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.explore-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.explore-lede {
  color: var(--text-secondary);
  font-size: 14px;
}

.explore-mine { margin-left: auto; flex: none; }

/* ── Toolbar: search + sort ───────────────────────────────────── */

.explore-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.explore-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.explore-search-icon {
  position: absolute;
  left: 14px;
  z-index: 1;
  /* Gold like every icon, focused or not. */
  color: var(--arbox-gold);
  pointer-events: none;
}

.explore-search-input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 44px 0 42px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--card-surface-strong);
  color: var(--text);
  font: 400 15px/1.4 var(--ui-font-family);
  text-overflow: ellipsis;
  outline: none;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color var(--t) ease, box-shadow var(--t) ease, background-color var(--t) ease;
}

.explore-search-input::placeholder { color: var(--text-muted); }

.explore-search-input:hover:not(:focus) { border-color: rgba(var(--white-rgb), .2); }

.explore-search-input:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring), var(--shadow);
}

.explore-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-right: 2px;
  border-radius: 50%;
  background:
    linear-gradient(45deg, transparent 45%, var(--text-secondary) 45%, var(--text-secondary) 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, var(--text-secondary) 45%, var(--text-secondary) 55%, transparent 55%);
  cursor: pointer;
}

.explore-search-kbd {
  position: absolute;
  right: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: rgba(var(--white-rgb), .04);
  color: var(--text-muted);
  font: 600 12px/1 var(--ui-font-family);
  pointer-events: none;
}

.explore-search:focus-within .explore-search-kbd,
.explore-search-input:not(:placeholder-shown) ~ .explore-search-kbd { display: none; }

.explore-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin-left: auto;
}

.explore-sort-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.explore-sort-select {
  width: auto;
  min-width: 128px;
  height: 34px;
  padding-right: 30px;
  background-color: var(--card-surface-strong);
  font-size: 13px;
  cursor: pointer;
}

.explore-sort-select option {
  background: var(--surface);
  color: var(--text);
}

/* ── Author header ────────────────────────────────────────────── */

.explore-owner {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px 20px;
  background: var(--card-surface-strong);
  animation: explore-in .3s var(--ease);
}

.owner-chip-avatar.explore-owner-avatar {
  width: 64px;
  height: 64px;
  font-size: 22px;
  box-shadow: 0 0 0 3px rgba(var(--ink-rgb), .6), var(--glow);
}

.explore-owner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.explore-owner-kicker { margin: 0; font-size: 11px; }

.explore-owner-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.015em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.explore-owner-name:focus { outline: none; }

.explore-owner-headline {
  color: var(--text-secondary);
  font-size: 14px;
}

.explore-owner-count {
  color: var(--text-muted);
  font-size: 12.5px;
}

.explore-owner-clear { margin-left: auto; flex: none; align-self: flex-start; }

/* ── Results bar ──────────────────────────────────────────────── */

.explore-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 30px;
  margin-bottom: 14px;
}

.explore-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.explore-filter-owner {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 4px 0 11px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 13px;
}

.explore-count {
  color: var(--text-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Grid + cards ─────────────────────────────────────────────── */

.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  transition: opacity var(--t) ease;
}

.explore-grid.is-loading { opacity: .55; }

.explore-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform var(--t) var(--ease), border-color var(--t) ease, box-shadow var(--t) ease;
}

/* Cards fade in on the first load and Load more; a new search swaps them at once. */
.explore-card.is-entering { animation: explore-in .32s var(--ease); }

.explore-card:hover,
.explore-card:has(.explore-card-link:focus-visible) {
  transform: translateY(-3px);
  border-color: rgba(var(--primary-rgb), .35);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .45), 0 0 0 1px rgba(var(--primary-rgb), .12), var(--glow);
}

.explore-card:has(.explore-card-link:focus-visible) {
  box-shadow: var(--focus-ring), 0 14px 38px rgba(0, 0, 0, .45), var(--glow);
}

.explore-card-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  flex: none;
  background:
    linear-gradient(135deg, rgba(var(--primary-rgb), .28) 0%, rgba(var(--secondary-rgb), .28) 100%),
    var(--surface);
}

.explore-card-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease), filter .3s ease;
}

.explore-card-cover.is-broken img { visibility: hidden; }

.explore-card-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(var(--primary-rgb), .22) 0%, transparent 60%),
    linear-gradient(180deg, transparent 55%, rgba(var(--ink-rgb), .5) 100%);
  opacity: .55;
  transition: opacity var(--t) ease;
}

.explore-card:hover .explore-card-cover img,
.explore-card:has(.explore-card-link:focus-visible) .explore-card-cover img {
  transform: scale(1.06);
  filter: saturate(1.12) brightness(1.06);
}

.explore-card:hover .explore-card-cover::after,
.explore-card:has(.explore-card-link:focus-visible) .explore-card-cover::after { opacity: 1; }

.explore-card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  display: flex;
  gap: 6px;
}

.explore-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: rgba(var(--ink-rgb), .66);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.explore-card-badge.is-featured {
  border-color: rgba(var(--warning-rgb), .5);
  color: var(--warning-text);
}

.explore-card-badge.is-yours {
  border-color: rgba(var(--primary-rgb), .5);
  color: var(--primary);
}

.explore-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  padding: 14px 16px 13px;
}

.explore-card-name {
  min-width: 0;
  overflow: hidden;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explore-card-link {
  color: var(--text);
  text-decoration: none;
}

.explore-card-link:focus-visible { outline: none; }

/* The whole card opens the arbox; the author link sits above this layer. */
.explore-card-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.explore-card-desc {
  display: -webkit-box;
  min-height: 3em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.explore-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.owner-chip.explore-card-owner {
  position: relative;
  z-index: 2;
  flex: 0 1 auto;
  margin-left: -2px;
}

.explore-card-meta {
  flex: none;
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

/* Loading placeholders (first load only) */
.explore-card.is-skeleton { pointer-events: none; animation: none; }

.explore-card.is-skeleton .explore-card-cover,
.explore-card .skeleton-line {
  background:
    linear-gradient(100deg, transparent 20%, rgba(var(--white-rgb), .06) 50%, transparent 80%) 0 0 / 200% 100%,
    rgba(var(--white-rgb), .04);
  animation: explore-shimmer 1.4s linear infinite;
}

.explore-card .skeleton-line {
  display: block;
  width: 100%;
  height: 11px;
  border-radius: 6px;
}

.explore-card .skeleton-line.is-title { width: 55%; height: 15px; margin-bottom: 4px; }
.explore-card .skeleton-line.is-short { width: 38%; margin-top: 10px; }

/* ── Empty, error, load more ──────────────────────────────────── */

.explore-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 48px 16px;
  text-align: center;
}

.explore-empty-text {
  max-width: 560px;
  color: var(--text-secondary);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.explore-error {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.explore-error .form-error { flex: 1 1 280px; }

.explore-more {
  display: flex;
  justify-content: center;
  padding-top: 28px;
}

.explore-more .btn { min-width: 180px; }

@keyframes explore-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes explore-shimmer { from { background-position: 100% 0, 0 0; } to { background-position: -100% 0, 0 0; } }

/* ── Narrow screens ───────────────────────────────────────────── */

@media (max-width: 860px) {
  .explore-main { padding: 20px 20px 36px; }
}

@media (max-width: 640px) {
  .explore-main { padding: 16px 16px 32px; }
  .explore-head { align-items: center; margin-bottom: 14px; }
  .explore-title { font-size: 22px; }
  .explore-lede { font-size: 13px; }
  .explore-mine span { display: none; }
  .explore-mine { padding: 0 12px; }

  .explore-search-input { height: 44px; padding-right: 12px; font-size: 16px; } /* 16px: no zoom on focus in iOS Safari */
  .explore-search-kbd { display: none; }
  .explore-sort-label { /* visually hidden, still the select's label */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .explore-sort-select { min-width: 116px; }

  .explore-owner { flex-wrap: wrap; gap: 12px 14px; padding: 16px; }
  .owner-chip-avatar.explore-owner-avatar { width: 52px; height: 52px; font-size: 18px; }
  .explore-owner-text { flex: 1 1 180px; }
  .explore-owner-name { font-size: 19px; }
  .explore-owner-clear { align-self: center; }

  .explore-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}

@media (hover: none) {
  .explore-card:hover { transform: none; }
}
