/* =========================================================
   profile.css — public profile dashboard (/u/:slug).
   Terminal geek skin. Self-contained: pairs with base.css
   (tokens + reset + typography) only. Defines every class
   emitted by public/profile.js.
========================================================= */

.app {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 44px) clamp(14px, 4vw, 36px) 72px;
}

/* ── shared utilities (profile.js uses these inline) ── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.wrap { flex-wrap: wrap; }
.scroll-y { overflow-y: auto; }
.flush { padding: 0; }

/* ── toast ── */
.toast {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom, 24px));
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-2);
  border: 1px solid var(--border-accent);
  color: var(--text-1);
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur), transform var(--dur);
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── chips & buttons ── */
.chip {
  display: inline-flex; align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  border: 1px solid var(--border-accent);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
}
.chip-muted {
  background: color-mix(in srgb, var(--text-3) 12%, transparent);
  border-color: var(--border);
  color: var(--text-3);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}
.btn:hover { border-color: var(--border-accent); }
.btn-s {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-fg);
  font-weight: 600;
}
.btn-s:hover { background: color-mix(in srgb, var(--accent) 88%, white); color: var(--accent-fg); }
.btn-g {
  background: var(--bg-2);
  color: var(--text-2);
}
.btn-g:hover { color: var(--accent); border-color: var(--border-accent); }
.btn-icon { width: 34px; height: 34px; padding: 0; font-size: 14px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── shell ── */
.profile-shell { display: flex; flex-direction: column; gap: 20px; }

/* ── overview band ── */
.profile-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.profile-overview-left { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.profile-identity-card {
  position: relative;
  display: flex; flex-direction: column; gap: 16px;
  padding: 22px 24px;
  border-radius: var(--r-lg);
  background: var(--bg-1);
  border: 1px solid var(--border);
  overflow: hidden;
}
.profile-identity-card::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 72%);
  z-index: 2;
}
.profile-cover-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0.16;
  filter: grayscale(0.3) saturate(1.1);
  z-index: 0;
}
.profile-identity-card.has-cover::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent, var(--bg-1) 92%);
  z-index: 0;
}
.profile-identity-card > * { position: relative; z-index: 1; }

.profile-id-main { display: flex; align-items: center; gap: 18px; }
.hero-avatar {
  flex: 0 0 auto;
  width: 76px; height: 76px;
  display: grid; place-items: center;
  border-radius: var(--r);
  background: var(--accent-soft);
  border: 1px solid var(--border-accent);
  color: var(--accent);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 34px;
  overflow: hidden;
}
.hero-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-id-copy { min-width: 0; }
.profile-id-copy h1 { font-size: clamp(24px, 3vw, 32px); margin: 2px 0 2px; }
.profile-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: var(--text-3);
}
.profile-kicker::before { content: '// '; color: var(--accent); }
.profile-handle {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}
.bio { margin: 8px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.55; }

.profile-stat-row {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.profile-stat-row span {
  display: flex; flex-direction: column; gap: 1px;
  min-width: 64px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-3);
  text-transform: uppercase;
}
.profile-stat-row strong {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  font-feature-settings: 'tnum' on;
  color: var(--text-1);
}

.profile-id-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.toolbar-brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}
.toolbar-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.toolbar-actions { display: flex; align-items: center; gap: 8px; }

/* ── focus card ── */
.profile-focus-card {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 22px 20px 24px;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  border: 1px solid var(--border-accent);
  box-shadow: var(--shadow);
}
.profile-focus-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
  border-radius: var(--r-lg) 0 0 var(--r-lg);
}
.profile-focus-card h2 { font-size: clamp(18px, 2vw, 22px); margin: 2px 0; }
.profile-focus-card p { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.profile-focus-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.profile-focus-list span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  padding-left: 14px; position: relative;
}
.profile-focus-list span::before { content: '▸'; position: absolute; left: 0; color: var(--accent); }

/* ── quick dock ── */
.profile-quick-dock { display: flex; flex-direction: column; gap: 12px; }
.profile-section-header { display: flex; align-items: baseline; gap: 10px; }
.profile-section-header h2 { font-size: 18px; }
.section-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-2);
}
.profile-site-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-site-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 12.5px;
  transition: border-color var(--dur-fast), transform var(--dur-fast);
}
.profile-site-pill:hover { border-color: var(--border-accent); transform: translateY(-1px); color: var(--text-1); }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.pill-meta { color: var(--text-3); font-size: 11px; }

/* ── dashboard grid ── */
.profile-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.profile-main-column,
.profile-side-column { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ── cards ── */
.card {
  display: flex; flex-direction: column;
  border-radius: var(--r-lg);
  background: var(--bg-1);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-h {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.card-h h3 { font-size: 15px; }
.card-b { padding: 16px; }
.card-b.flush { padding: 0; }
.card-b.scroll-y { max-height: 360px; }
.profile-card-tall .card-b.scroll-y { max-height: 460px; }

/* ── list items ── */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  transition: background var(--dur-fast);
}
.list-item:last-child { border-bottom: none; }
a.list-item:hover { background: var(--accent-soft); }
.list-item-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-item-title {
  margin: 0; font-size: 13.5px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-item-sub {
  margin: 0; font-family: var(--font-mono); font-size: 11px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── report body ── */
.report-body ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.report-body li { font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.report-body code {
  font-family: var(--font-mono); font-size: 12px;
  padding: 1px 5px; border-radius: var(--r-xs);
  background: var(--accent-soft); color: var(--accent);
}

/* ── progress card ── */
.profile-progress-card .card-b { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.prog-item { display: flex; flex-direction: column; gap: 6px; }
.prog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.prog-head h4 { font-size: 13.5px; }
.pbar {
  height: 8px;
  border-radius: var(--r-xs);
  background: var(--bg-3);
  border: 1px solid var(--border);
  overflow: hidden;
}
.pbar-fill {
  height: 100%;
  background-color: var(--accent);
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255,255,255,0.18) 0, rgba(255,255,255,0.18) 4px,
    transparent 4px, transparent 8px
  );
  transition: width var(--dur-slow) var(--ease-out);
}
.prog-sub { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }

/* ── pet card ── */
.pet-card {
  display: flex; flex-direction: column; gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--r);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
}
.pet-card.rarity-rare      { border-left-color: var(--giverny-pond); }
.pet-card.rarity-epic      { border-left-color: var(--giverny-wisteria); }
.pet-card.rarity-legendary { border-left-color: var(--giverny-sun); }
.pet-card.shiny { box-shadow: 0 0 0 1px var(--accent-glow), var(--shadow); }
.pet-info { display: flex; flex-direction: column; gap: 6px; }
.pet-info h4 { font-size: 15px; }
.pet-info p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.pet-rarity-row { display: flex; align-items: center; gap: 8px; }
.pet-rarity-stars { color: var(--giverny-sun); letter-spacing: 0.08em; font-size: 13px; }

.pet-asset { display: grid; place-items: center; }
.pet-asset img { max-width: 160px; width: 100%; height: auto; }
.pet-stage-asset .buddy-stage {
  position: relative;
  width: 100%; max-width: 220px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: var(--r);
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--bg-1);
  background-size: 22px 22px, 22px 22px, auto;
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
}
.buddy-stage-overlay, .buddy-scene-canvas { position: absolute; inset: 0; }
.buddy-cloud, .buddy-stars, .buddy-perch { display: none; }
.buddy-stage-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 14%;
}
.buddy-stage-fallback img { width: 100%; height: 100%; object-fit: contain; }

/* ── embeds ── */
.embed-frame { border: 0; display: block; width: 100%; }

/* ── footer ── */
.profile-footer {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}
.monet-credit { font-family: var(--font-mono); color: var(--text-3); letter-spacing: 0.04em; }

/* ── error state ── */
.profile-hero {
  display: flex; flex-direction: column; gap: 10px;
  padding: clamp(40px, 8vw, 80px) 0;
  text-align: center;
}
.profile-hero h1 { font-size: clamp(28px, 4vw, 40px); }
.profile-hero h1 span {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
}
.profile-hero .bio { text-align: center; }

/* ── responsive ── */
@media (max-width: 860px) {
  .profile-overview { grid-template-columns: 1fr; }
  .profile-dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .profile-id-main { flex-direction: column; align-items: flex-start; gap: 12px; }
  .profile-id-toolbar { flex-direction: column; align-items: flex-start; gap: 10px; }
}
