/* ═══════════════════════════════════════════════════════════════════════════════
   profile.css — /profile.html (Phase 3C)
═══════════════════════════════════════════════════════════════════════════════ */

.profile-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 18px 80px;
  position: relative;
  z-index: 1;
}

/* ─── Hero ─── */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 20px;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(96, 165, 250, 0.16) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(167, 139, 250, 0.10) 0%, transparent 55%),
    linear-gradient(180deg, rgba(14, 20, 36, 0.85), rgba(10, 15, 29, 0.6));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}
.profile-hero::before {
  content: '';
  position: absolute; top: 0; left: 18%; right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #60a5fa, #a78bfa, transparent);
  opacity: 0.65;
}
.profile-hero-avatar {
  position: relative;
  width: 76px; height: 76px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, #1a2236 0%, #0a0f1d 75%);
  border: 2px solid rgba(96, 165, 250, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 10px 22px rgba(59, 130, 246, 0.30);
}
.profile-hero-emoji {
  font-size: 40px;
  line-height: 1;
}
.profile-hero-hat {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%) rotate(-6deg);
  font-size: 26px;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}
.profile-hero-body { flex: 1; min-width: 0; }
.profile-hero-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #93c5fd;
  margin-bottom: 4px;
}
.profile-hero-level {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 8px;
  color: #f1f5fb;
  letter-spacing: -0.02em;
}
.profile-hero-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.profile-hero-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  transition: width 0.6s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.profile-hero-xp {
  margin-top: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: #a8b6d1;
}

.profile-share-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.32);
  border-radius: 12px;
  color: #93c5fd;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.profile-share-btn:hover { background: rgba(96, 165, 250, 0.20); }

/* ─── Sections ─── */
.profile-section { margin: 0 0 30px; }
.profile-section h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #f1f5fb;
  margin: 0 0 14px;
  letter-spacing: -0.015em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.profile-section-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #7c90ae;
  font-weight: 600;
}

/* ─── Stats grid ─── */
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 480px) { .profile-stats-grid { grid-template-columns: 1fr 1fr; } }
.profile-stat {
  padding: 14px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  text-align: center;
  /* Floor at 44px so the 2-col mobile stack clears the touch target
     spec — the cards are decorative but tap-able when adjacent to
     the share/reset buttons; consistent target sizing matters. */
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.profile-stat-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #f1f5fb;
  letter-spacing: -0.02em;
}
.profile-stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7c90ae;
  margin-top: 3px;
}

/* ─── Heatmap ─── */
.profile-heatmap {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 5px;
}
.profile-heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.03);
}
.profile-heatmap-cell[data-level="1"] { background: rgba(96, 165, 250, 0.30); }
.profile-heatmap-cell[data-level="2"] { background: linear-gradient(135deg, #4ade80, #22c55e); border-color: rgba(74, 222, 128, 0.5); }
.profile-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 11px;
  color: #7c90ae;
}
.profile-heatmap-legend .profile-heatmap-cell { width: 12px; height: 12px; aspect-ratio: auto; }

/* ─── Hats grid ─── */
.profile-hats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.profile-hat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.profile-hat-tile:hover:not(:disabled) { transform: translateY(-2px); border-color: rgba(96, 165, 250, 0.35); }
.profile-hat-tile.is-locked { opacity: 0.45; cursor: not-allowed; }
.profile-hat-tile.is-wearing {
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.16), rgba(96, 165, 250, 0.06));
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.22);
}
.profile-hat-emoji { font-size: 28px; line-height: 1; }
.profile-hat-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #e8edf8;
  line-height: 1.25;
}
.profile-hat-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7c90ae;
}
.profile-hat-tile.is-wearing .profile-hat-meta { color: #93c5fd; }

/* ─── Laurels ─── */
.profile-laurels {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-laurels-empty {
  color: #7c90ae;
  font-size: 13px;
  text-align: center;
  padding: 24px 0;
  font-style: italic;
  margin: 0;
}
.profile-laurel {
  --brand-color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--brand-color) 12%, rgba(14, 20, 36, 0.7)),
    color-mix(in srgb, var(--brand-color) 4%, rgba(10, 15, 29, 0.5)));
  border: 1px solid color-mix(in srgb, var(--brand-color) 35%, transparent);
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.profile-laurel-wreath {
  font-size: 32px;
  line-height: 1;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--brand-color) 65%, transparent));
}
.profile-laurel-body { flex: 1; min-width: 0; }
.profile-laurel-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #f1f5fb;
}
.profile-laurel-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--brand-color);
  margin-top: 2px;
}

/* ─── Reset ─── */
.profile-section--danger { text-align: center; margin-top: 40px; }
.profile-reset {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.30);
  color: #fda4a4;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.profile-reset:hover { background: rgba(239, 68, 68, 0.10); }
.profile-reset-note {
  margin: 6px 0 0;
  color: #6b7c97;
  font-size: 11px;
}

/* ─── Share modal ─── */
.profile-share-modal {
  position: fixed; inset: 0;
  z-index: 9700;
  display: flex; align-items: center; justify-content: center;
}
.profile-share-modal[hidden] { display: none; }
.profile-share-backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 8, 18, 0.7);
  backdrop-filter: blur(8px);
  opacity: 0; transition: opacity 0.2s ease;
}
.profile-share-modal.is-open .profile-share-backdrop { opacity: 1; }
.profile-share-panel {
  position: relative;
  width: min(92%, 460px);
  background: linear-gradient(180deg, #0e1424 0%, #0a0f1d 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 28px 22px 22px;
  text-align: center;
  transform: scale(0.94);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.2s ease;
}
.profile-share-modal.is-open .profile-share-panel { transform: scale(1); opacity: 1; }
.profile-share-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: none; color: #cbd5e1; cursor: pointer;
}
.profile-share-panel h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  margin: 0 0 14px;
  color: #f1f5fb;
}
#profile-share-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 16px;
  background: #0a0f1d;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.profile-share-actions {
  display: flex;
  gap: 8px;
}
.profile-share-actions .cta-primary,
.profile-share-actions .cta-secondary {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
}
.profile-share-actions .cta-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
}
.profile-share-actions .cta-secondary {
  background: transparent;
  color: #a8b6d1;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ─── Empty state (first-time visitor) ────────────────────────────────── */
.profile-empty-state {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 18px 20px;
  margin: 0 0 18px;
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.10), rgba(96, 165, 250, 0.02));
  border: 1px solid rgba(96, 165, 250, 0.20);
  border-radius: 16px;
}
.profile-empty-state-emoji {
  font-size: 44px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.profile-empty-state-body { flex: 1; min-width: 0; }
.profile-empty-state-body h2 {
  margin: 0 0 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 19px;
  font-weight: 800;
  color: #f1f5fb;
  letter-spacing: -0.01em;
}
.profile-empty-state-body p {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.55;
  color: #a8b6d1;
}
.profile-empty-state-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.profile-empty-state-actions .cta-primary,
.profile-empty-state-actions .cta-secondary {
  padding: 10px 18px;
  font-size: 14px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.profile-empty-state-actions .cta-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
}
.profile-empty-state-actions .cta-secondary {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
@media (max-width: 480px) {
  .profile-empty-state { flex-direction: column; }
  .profile-empty-state-emoji { font-size: 36px; }
}

/* ─── Hero username row (signed-in) ──────────────────────────────────── */
.profile-hero-username-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.profile-hero-username {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #cbd5e1;
}
.profile-username-edit {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: #93c5fd;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}
.profile-username-edit:hover { background: rgba(96,165,250,0.20); }

/* ─── Account section ─────────────────────────────────────────────────── */
.profile-section--account .profile-account-body {
  background: linear-gradient(180deg, rgba(96,165,250,0.06), rgba(96,165,250,0.01));
  border: 1px solid rgba(96,165,250,0.18);
  border-radius: 14px;
  padding: 18px 18px;
}
.profile-account-anon-text {
  margin: 0 0 14px;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.55;
}
.profile-account-anon .cta-primary {
  display: inline-flex;
  align-items: center;
  padding: 11px 18px;
  font-size: 14px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  min-height: 44px;
}
.profile-account-signed { display: flex; flex-direction: column; gap: 16px; }
.profile-account-info-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7c90ae;
  margin-bottom: 4px;
}
.profile-account-info-email {
  font-size: 15px;
  font-weight: 600;
  color: #e8edf8;
  word-break: break-all;
}
.profile-account-info-sync {
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #4ade80;
}
.profile-account-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.profile-account-signout {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  background: rgba(255,255,255,0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  cursor: pointer;
  min-height: 44px;
}
.profile-account-signout:hover { background: rgba(255,255,255,0.10); }
.profile-account-delete {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  background: transparent;
  color: #fca5a5;
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: 10px;
  cursor: pointer;
  min-height: 44px;
}
.profile-account-delete:hover {
  background: rgba(239,68,68,0.10);
  color: #fecaca;
  border-color: rgba(248,113,113,0.40);
}
.profile-account-delete:disabled { opacity: 0.5; cursor: progress; }
