/* ─────────────────────────────────────────────────────────────
   Публичная витрина автора /author/{handle}.
   Эталон: data/_disign/profile-viewer.jsx (AuthorProfileBody).
   Десктоп + мобайл через один markup + media. Токены — base.css.
   ───────────────────────────────────────────────────────────── */

.ap-page { font-family: 'Manrope', sans-serif; color: var(--text); }

/* ── Hero (navy-градиент) ────────────────────────────────────── */
.ap-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--navy) 0%, #1A2A5C 100%);
  /* full-bleed navy; гориз. отступы — на .ap-hero-inner (как контейнер каталога) */
  padding: 20px 0 22px;
}
/* лёгкий диагональный паттерн поверх градиента (как в превью дизайна) */
.ap-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(45deg, transparent 0 9px, rgba(255, 255, 255, 0.025) 9px 10px);
  pointer-events: none;
}
.ap-hero-glow {
  position: absolute;
  right: -80px;
  top: -80px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.13) 0%, transparent 70%);
  pointer-events: none;
}
.ap-hero-inner {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 60px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.ap-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(255, 255, 255, 0.1);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.ap-avatar--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
}
/* Топ-авторы (есть tier) — тонкое золотое свечение вокруг аватара. */
.ap-avatar--tier {
  border-color: #FFC107;
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.18), 0 0 18px rgba(255, 193, 7, 0.4);
}

.ap-id { flex: 1; min-width: 0; }
.ap-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.ap-name { margin: 0; font-size: 22px; font-weight: 800; color: #fff; letter-spacing: -0.02em; line-height: 1.1; }
.ap-tier {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.24), rgba(255, 193, 7, 0.14));
  color: #FFE08A;
  border: 1px solid rgba(255, 193, 7, 0.4);
  box-shadow: 0 0 12px rgba(255, 193, 7, 0.2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ap-tier-star { color: #FFC107; text-shadow: 0 0 6px rgba(255, 193, 7, 0.6); }
.ap-handle { font-size: 12px; color: rgba(255, 255, 255, 0.65); margin-bottom: 8px; }
.ap-stats { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: rgba(255, 255, 255, 0.85); }
.ap-stat-v { color: #fff; font-weight: 800; }
.ap-stats-dot { color: rgba(255, 255, 255, 0.3); }

.ap-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
/* Кнопки hero — единый ховер-стандарт (transition + лёгкий подъём). */
.ap-follow {
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.ap-follow:hover { transform: translateY(-1px); filter: brightness(1.06); }
.ap-follow.is-following,
.ap-follow[data-followed="1"] {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: none;
}
.ap-follow[data-follow-busy="1"] { opacity: 0.6; pointer-events: none; }

.ap-share {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, transform 0.18s ease;
}
.ap-share:hover { background: rgba(255, 255, 255, 0.2); transform: translateY(-1px); }
.ap-share.is-copied { background: var(--accent); border-color: var(--accent); }

/* ── Сетка шаблонов ──────────────────────────────────────────── */
.ap-templates { max-width: 1440px; margin: 0 auto; padding: 40px 60px 60px; }
.ap-sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 28px; }
.ap-sec-title { margin: 0; font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.ap-sec-sub { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); }

.ap-empty {
  padding: 56px 24px;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--divider);
  border-radius: 16px;
}
.ap-empty-ico {
  width: 60px;
  height: 60px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--card);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ap-empty-title { font-size: 16px; font-weight: 800; color: var(--text); }
.ap-empty-sub { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* Плотность как в каталоге: карточки ~190px, gap 16 (без сайдбара даёт больше колонок). */
.ap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}
.ap-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.ap-thumb {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ap-thumb--v { aspect-ratio: 9 / 16; }
.ap-thumb--h { aspect-ratio: 16 / 9; }
.ap-card:hover .ap-thumb { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18); }
.ap-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ap-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.ap-thumb-swaps,
.ap-thumb-dur {
  position: absolute;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}
.ap-thumb-swaps { left: 8px; display: inline-flex; align-items: center; gap: 4px; }
.ap-thumb-dur { right: 8px; font-family: ui-monospace, Menlo, monospace; }

.ap-card-name { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3; }
.ap-card-meta { display: flex; justify-content: space-between; align-items: baseline; margin-top: 4px; }
.ap-card-swaps { font-size: 11px; color: var(--text-muted); }
.ap-card-price { font-size: 13px; font-weight: 800; color: var(--text); }

/* ── Плашка «это ваш профиль» (только владельцу) ─────────────── */
.ap-ownbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--divider);
  font-size: 13px;
}
.ap-ownbar-txt { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.ap-ownbar-txt svg { color: var(--accent); flex-shrink: 0; }
.ap-ownbar-btn {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  transition: filter 0.18s ease, transform 0.18s ease;
}
.ap-ownbar-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }

/* ── Тост (копирование ссылки share) ─────────────────────────── */
.ap-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(10px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1000;
  pointer-events: none;
}
.ap-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Планшет ─────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  .ap-hero { padding: 20px 0 22px; }
  .ap-hero-inner { padding: 0 20px; }
  .ap-templates { padding: 28px 20px 40px; }
  .ap-sec-title { font-size: 22px; }
}

/* ── Мобайл (телефон): центрированная карточка hero, как в дизайне ─ */
@media (max-width: 600px) {
  .ap-hero { padding: 24px 0 22px; }
  .ap-hero-inner { flex-direction: column; align-items: center; text-align: center; gap: 10px; }
  .ap-avatar { width: 76px; height: 76px; border-width: 2.5px; }
  .ap-id { flex: none; width: 100%; }
  .ap-name-row { justify-content: center; }
  .ap-name { font-size: 20px; }
  .ap-handle { margin-bottom: 0; }

  /* Статы — единая плашка с вертикальными разделителями (значение над лейблом). */
  .ap-stats {
    width: 100%;
    max-width: 360px;
    margin: 4px auto 0;
    padding: 10px 4px;
    gap: 0;
    flex-wrap: nowrap;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
  }
  .ap-stats-dot { display: none; }
  .ap-stat {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0;   /* схлопывает пробел между значением и лейблом */
    border-left: 1px solid rgba(255, 255, 255, 0.12);
  }
  .ap-stat:first-of-type { border-left: none; }
  .ap-stat-v { font-size: 15px; letter-spacing: -0.02em; }
  .ap-stat-l { font-size: 10px; color: rgba(255, 255, 255, 0.55); }

  .ap-actions { width: 100%; margin-top: 4px; }
  .ap-follow { flex: 1; height: 44px; }
  .ap-share { width: 44px; height: 44px; }
  .ap-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .ap-card-name { font-size: 13px; }
  .ap-sec-head { margin-bottom: 18px; }
}
