/* ============================================================================
 * editor.css — Redesign A2 surface composition for /marketplace/{username}.
 * Inherits A1 tokens.css + components.css. Mirror of marketplace.css structure.
 *
 * Surface scope: .ed-r — single container that anchors editor-specific
 * cascade plus per-editor theme custom-property overrides.
 *
 * Token-only policy: every value either consumes a tokens.css custom property
 * or is a layout primitive (px / %). NO new color literals here.
 * ========================================================================== */

.ed-r {
  /* Per-editor theme color hooks. Inline <style> in the template overrides
   * these on a tier-aware basis when editor.rich.theme_colors is present.
   * Defaults inherit the brand accent so unscoped editors still render. */
  --ed-primary: var(--accent);
  --ed-secondary: var(--accent-bright);
  --ed-accent: var(--accent-glow);
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--surface-0);
  min-height: 100vh;
}

.ed-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 96px var(--space-4) var(--space-16);
}

/* ============================================================================
 * Hero banner (optional thumbnail card image)
 * ========================================================================== */

.ed-hero-banner-wrap {
  max-width: 1100px;
  margin: 80px auto var(--space-6);
  padding: 0 var(--space-4);
}

.ed-hero-banner {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
}

/* ============================================================================
 * Breadcrumb + claim banner
 * ========================================================================== */

.ed-crumb {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.ed-crumb a { color: var(--text-secondary); text-decoration: none; }
.ed-crumb a:hover { color: var(--accent-bright); }

.ed-claim-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.ed-claim-banner-msg { color: var(--text-primary); }
.ed-claim-banner-actions { display: flex; gap: var(--space-2); }

/* ============================================================================
 * Hero / header region — display name, tier badge, stats, claim CTA
 * ========================================================================== */

.ed-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-6);
  align-items: start;
  padding: var(--space-6);
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}

.ed-hero-left {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.ed-hero-avatar {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-pill);
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--accent-bright);
  border: 2px solid var(--ed-primary);
  box-shadow: 0 0 0 1px var(--surface-0), 0 0 24px -4px var(--ed-accent);
  overflow: hidden;
  flex-shrink: 0;
}

.ed-hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ed-headline { min-width: 0; }

.ed-headline h1 {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.ed-handle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-block;
  margin-bottom: var(--space-2);
}

.ed-handle:hover { color: var(--accent-bright); }

.ed-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.ed-bio {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-2);
  max-width: 60ch;
}

.ed-niche-collection-link {
  font-size: var(--text-sm);
  color: var(--accent-bright);
  text-decoration: none;
}

.ed-niche-collection-link:hover { color: var(--accent); }

.ed-hero-right {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  min-width: 280px;
}

.ed-stat {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.ed-stat-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.ed-stat-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.ed-hero-cta {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* ============================================================================
 * Niches & genres row — read-only chip primitives
 * ========================================================================== */

.ed-niches {
  margin-bottom: var(--space-5);
}

.ed-niches h2 {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.ed-niches-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ============================================================================
 * Pricing section
 * ========================================================================== */

.ed-pricing {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.ed-price-grid {
  display: grid;
  gap: var(--space-2);
}

.ed-price-row {
  display: grid;
  grid-template-columns: 80px auto 1fr;
  gap: var(--space-3);
  align-items: baseline;
  padding: var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius-md);
}

.ed-price-qty { color: var(--text-muted); font-size: var(--text-sm); }
.ed-price-total {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.ed-price-per { font-size: var(--text-sm); color: var(--text-secondary); }
.ed-price-discount { color: var(--state-success); }

.ed-price-big {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.ed-price-sub { margin-top: var(--space-2); font-size: var(--text-sm); }
.ed-ok { color: var(--state-success); }
.ed-muted { color: var(--text-muted); }

.ed-fair-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  background: var(--surface-3);
  border: 1px solid var(--border-default);
}

.ed-fair-label { color: var(--text-secondary); font-weight: var(--weight-medium); }
.ed-fair-range { color: var(--text-muted); }

/* ============================================================================
 * Rich content — Archetype + Music Taste + Visual DNA (re-skinned, kept)
 * ========================================================================== */

.ed-rich-section {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.ed-rich-archetype .ed-rich-archetype-name { color: var(--ed-primary); }

.ed-rich-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.ed-rich-archetype-name {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  color: var(--ed-primary);
  margin-bottom: var(--space-2);
}

.ed-rich-archetype-desc {
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  font-size: var(--text-sm);
}

.ed-rich-topbadge {
  display: inline-block;
  margin-top: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--accent-dim);
  color: var(--ed-primary);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

.ed-rich-h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.ed-rich-subhead {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: var(--space-3) 0 var(--space-2);
}

.ed-rich-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.ed-rich-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.ed-rich-pill-score {
  color: var(--accent-bright);
  font-weight: var(--weight-semibold);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.ed-rich-pill-artist { background: var(--accent-dim); color: var(--accent-bright); }

.ed-rich-visual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.ed-rich-visual-grid > div {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius-md);
}

.ed-rich-visual-grid > div > span:first-child {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ed-rich-visual-grid > div > span:last-child {
  color: var(--text-primary);
  font-size: var(--text-sm);
}

/* ============================================================================
 * Sounds — vertical dense list per Wave 2 ratified decision
 * ========================================================================== */

.ed-sounds {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.ed-sounds h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.ed-sounds-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.ed-sound-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: transform var(--motion-fast) var(--ease-out-expo);
}

.ed-sound-row:hover {
  transform: translateY(-1px);
  background: var(--surface-3);
}

/* Single-use square thumbnail (components.css .avatar is pill-only). */
.ed-sound-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: var(--weight-bold);
  font-size: var(--text-base);
}

.ed-sound-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.ed-sound-title {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ed-sound-author {
  font-size: var(--text-xs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ed-sound-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.ed-sound-link {
  opacity: 0;
  color: var(--text-muted);
  font-size: var(--text-base);
  transition: opacity var(--motion-fast) var(--ease-out-expo);
}

.ed-sound-row:hover .ed-sound-link,
.ed-sound-row:focus-within .ed-sound-link { opacity: 1; }

.ed-sound-link:hover { color: var(--accent-bright); }

.ed-sounds-show-all {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease-out-expo);
}

.ed-sounds-show-all:hover { border-color: var(--accent); color: var(--text-primary); }

/* ============================================================================
 * History — bottom-sheet trigger + always-empty state (data layer not yet
 * surfaced; see FOLLOWUP for editor.history wiring)
 * ========================================================================== */

.ed-history {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.ed-history h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

/* ============================================================================
 * Similar editors — carousel (default per spec, mirroring marketplace
 * showcase strip §3.4)
 * ========================================================================== */

.ed-similar { margin-bottom: var(--space-5); }

.ed-similar h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.ed-similar-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 280px);
  gap: var(--space-3);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.ed-similar-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  scroll-snap-align: start;
  transition: transform var(--motion-fast) var(--ease-out-expo),
              border-color var(--motion-fast) var(--ease-out-expo);
}

.ed-similar-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.ed-similar-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ed-similar-handle { font-size: var(--text-sm); color: var(--text-muted); }
.ed-similar-meta {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
 * Contacts grid
 * ========================================================================== */

.ed-contacts {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.ed-contacts h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.ed-contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-3);
}

.ed-contact-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.ed-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.ed-dot.green { background: var(--state-success); }
.ed-dot.amber { background: var(--state-warning); }

.ed-contact-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ed-contact-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ed-contact-value {
  color: var(--text-primary);
  font-size: var(--text-sm);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.ed-contact-value:hover { color: var(--accent-bright); }

.ed-copy {
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-2);
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease-out-expo);
}

.ed-copy:hover { border-color: var(--accent); color: var(--text-primary); }

/* ============================================================================
 * Gallery (recent video covers)
 * ========================================================================== */

.ed-gallery {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.ed-gallery h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.ed-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-2);
}

.ed-cover {
  display: block;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-3);
  transition: transform var(--motion-fast) var(--ease-out-expo);
}

.ed-cover:hover { transform: translateY(-2px); }
.ed-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ============================================================================
 * Inquiry form (label-side contact CTA flow)
 * ========================================================================== */

.ed-inquiry {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.ed-inquiry h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.ed-inquiry-sub {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.ed-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.ed-form-row { display: flex; flex-direction: column; gap: var(--space-1); }
.ed-form-row.full { grid-column: 1 / -1; }

.ed-form-row label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ed-form-row input,
.ed-form-row select,
.ed-form-row textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

.ed-form-row input:focus,
.ed-form-row select:focus,
.ed-form-row textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

.ed-inquiry-status {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  min-height: 1.2em;
}

/* ============================================================================
 * Bounty CTA card
 * ========================================================================== */

.ed-bounty-cta {
  background: linear-gradient(135deg, var(--accent-dim), transparent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.ed-bounty-cta h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.ed-bounty-cta p { color: var(--text-secondary); font-size: var(--text-sm); }

/* ============================================================================
 * 404 fallback
 * ========================================================================== */

.ed-not-found {
  text-align: center;
  padding: var(--space-16) var(--space-4);
}

.ed-not-found h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.ed-not-found p { color: var(--text-secondary); }

/* ============================================================================
 * Responsive — ≤ 768px stacks hero columns and tightens spacing
 * ========================================================================== */

@media (max-width: 768px) {
  .ed-container { padding: 80px var(--space-3) var(--space-20); }

  .ed-hero {
    grid-template-columns: minmax(0, 1fr);
    padding: var(--space-4);
  }

  .ed-hero-left {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .ed-hero-avatar {
    width: 64px;
    height: 64px;
    font-size: var(--text-2xl);
  }

  .ed-headline h1 { font-size: var(--text-2xl); }

  .ed-hero-right {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .ed-stat-value { font-size: var(--text-lg); }

  /* Inline header CTA hides on mobile; sticky CTA bar takes over */
  .ed-hero-cta { display: none; }

  .ed-rich-visual-grid { grid-template-columns: minmax(0, 1fr); }
  .ed-form-grid { grid-template-columns: minmax(0, 1fr); }

  .ed-history {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }
}

/* ============================================================================
 * @starting-style — A2 surface fade-in for content blocks
 * ========================================================================== */

@starting-style {
  .ed-r .ed-hero,
  .ed-r .ed-pricing,
  .ed-r .ed-rich-section,
  .ed-r .ed-sounds,
  .ed-r .ed-history,
  .ed-r .ed-similar,
  .ed-r .ed-contacts,
  .ed-r .ed-gallery,
  .ed-r .ed-inquiry,
  .ed-r .ed-bounty-cta {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--motion-slow) var(--ease-out-expo),
                transform var(--motion-slow) var(--ease-out-expo);
  }
}
