/* Badge overlay + badge cards (warm-carbon themed). */

.profile-badges-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease;
}
.profile-badges-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.badges-overlay {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.badges-overlay-hd {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.badges-overlay-title {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-0);
  margin: 0;
}
.badges-overlay-sub {
  font-size: 13px;
  color: var(--text-2);
  margin: 0;
  line-height: 1.5;
}

.badges-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.badges-section-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.badges-section-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 99px;
}
.badges-empty {
  font-size: 13px;
  color: var(--text-3);
  margin: 0;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.badge-card {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 44px;
  transition: border-color 120ms ease, transform 120ms ease, opacity 120ms ease, box-shadow 160ms ease;
}
/* Active badge — whole card is draggable, no separate grip handle. */
.badge-card[data-drag-source="1"]        { cursor: grab; }
.badge-card[data-drag-source="1"]:active { cursor: grabbing; }

/* While dragging: dim the source card so the gap reads. */
.badge-card.is-dragging {
  opacity: 0.4;
  cursor: grabbing;
  border-color: var(--accent);
}

/* When the grid is in drag mode, suppress every other card's hover
   styles — otherwise the user sees the normal :hover treatment on
   each card they pass over, which feels noisy. */
.badges-grid.is-drag-active .badge-card[data-toggle-target]:hover {
  transform: none;
  border-color: var(--border);
  background: var(--bg-1);
}
.badges-grid.is-drag-active .badge-card.badge-card--active:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

/* The orange drop indicator. A single vertical bar appended to the
   grid as a position:absolute child — JS sets `left`, `top` and
   `height` based on the target card's bounding box. The bar lives in
   the GRID's coordinate system (grid gets position: relative inline
   on dragstart), so it slides into the seam between cards. */
.badges-drop-bar {
  position: absolute;
  width: 3px;
  pointer-events: none;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent-glow), 0 0 2px var(--accent);
  opacity: 0;
  transition: left 140ms cubic-bezier(0.2, 0.7, 0.3, 1),
              top  140ms cubic-bezier(0.2, 0.7, 0.3, 1),
              height 140ms ease,
              opacity 120ms ease;
  z-index: 5;
}
.badges-drop-bar.is-shown { opacity: 1; }
.badge-card[data-toggle-target] {
  cursor: pointer;
  user-select: none;
}
.badge-card[data-toggle-target]:hover { transform: translateY(-1px); }
.badge-card[data-toggle-target]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.badge-card-icon {
  font-size: 22px;
  text-align: center;
  line-height: 1;
}
.badge-card-name {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-0);
  line-height: 1.2;
}
.badge-card-desc {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.3;
}
.badge-card-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
}

/* Unlocked cards default to a slightly muted "off" look; the --active
   modifier brings them up to full brightness with the accent border. */
.badge-card--unlocked { opacity: 0.72; }
.badge-card--unlocked.badge-card--active {
  opacity: 1;
  border-color: var(--accent);
}
.badge-card--locked {
  filter: grayscale(0.6);
  opacity: 0.5;
}

/* "Super" badge — Diamond rung + Expert. Same size as the regular
   card (don't bump border width, that throws layout off vs locked). */
.badge-card--super {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent-glow), var(--bg-1));
}
.badge-card--super.badge-card--active {
  box-shadow: 0 0 14px var(--accent-glow);
}
.badge-card--super .badge-card-icon {
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.badge-card-lock {
  font-size: 16px;
  color: var(--text-3);
  text-align: center;
}

/* Founder EF badge — solid orange tile with black bold "EF" text in
   place of an emoji icon. Mirrors the .profile-badge[data-slug="ef"]
   styling but sized for the larger overlay card. */
.badge-card[data-slug="ef"] {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent-glow), var(--bg-1));
  box-shadow: 0 0 8px var(--accent-glow);
}
.badge-card[data-slug="ef"] .badge-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #1a1816;
  border-radius: 50%;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* In-card status pill (read-only — the card itself is the click target).
   Fixed width so the card doesn't reflow when the label flips between
   "ON" and "OFF" (the longer of the two sets the box). */
.badge-card-state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-3);
}
.badge-card--active .badge-card-state-pill {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
}


/* Skill-managed states — Beginner is auto-applied below skill 5, camps
   require their skill to reach 5 before they can be worn. The cards
   render with the same footprint as regular badge cards but the toggle
   affordance is removed (no cursor:pointer, no aria-pressed, no JS bind).
   A small "🔒 reason" line replaces the "Earned MMM D, Y" meta so the
   user understands why they can't flip it. */
.badge-card--forced,
.badge-card--skill-locked {
  cursor: default;
}
.badge-card--forced:hover,
.badge-card--skill-locked:hover {
  transform: none;
  border-color: var(--border);
}
.badge-card-meta--lock {
  color: var(--text-3);
  font-style: italic;
}
/* Forced badge (only `beginner` for now). The active state still
   reflects the truth (rapi < 5 → On), but the pill is rendered in a
   muted neutral color to signal "not your choice". */
.badge-card-state-pill--forced {
  background: var(--bg-3) !important;
  color: var(--text-2) !important;
  border-color: var(--border-strong) !important;
}
/* Earned-but-skill-locked badge (camp_python with py<5, camp_csharp
   with cs<5). The card sits in the Unlocked section but is greyed out
   so the user immediately reads "I have this but can't wear it yet". */
.badge-card--skill-locked {
  filter: grayscale(0.5);
  opacity: 0.7;
}
.badge-card-state-pill--locked {
  background: transparent !important;
  color: var(--text-3) !important;
  border-color: var(--border-strong) !important;
}

/* Footer note explaining the super-badge highlight. */
.badges-overlay-foot {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-top: 4px;
  background: var(--bg-2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
}
.badges-overlay-foot-icon {
  font-size: 14px;
  line-height: 1;
}
.badges-overlay-foot strong { color: var(--accent); }

/* Section help / cap-hit chip. */
.badges-section-help {
  font-size: 11.5px;
  color: var(--text-3);
  margin: 4px 0 8px;
}
.badges-section-count.is-cap-hit {
  color: var(--bg-0);
  background: var(--accent);
  border-color: var(--accent);
  padding: 2px 8px;
  border-radius: 99px;
}

/* Toast for cap-hit / skill-locked / network errors. */
.badges-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(8px);
  z-index: 600;
  padding: 10px 16px;
  background: var(--bg-1);
  border: 1px solid var(--accent);
  border-radius: 99px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-0);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 12px var(--accent-glow);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: none;
  max-width: min(440px, calc(100vw - 32px));
  text-align: center;
}
.badges-toast.is-shown {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Shared badge chip ────────────────────────────────────────────────
   The icon-only circular badge chip. Lives here (site-wide stylesheet)
   rather than auth.css so the SAME chip renders identically everywhere it
   appears: the profile card name-row AND doc-page comment bylines (which
   don't load auth.css). Comment bylines reuse these exact classes
   (profile-badge / profile-badge-icon / --super / data-slug) via
   comments.js, so any visual change here applies to both surfaces.
   Order matters: base first, then the bg/border overrides (--super, ef,
   _diamond) so they win over the base background. */
.profile-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-1);
  cursor: default;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.profile-badge:hover { transform: translateY(-1px); border-color: var(--accent); }
.profile-badge-icon {
  font-size: 13px;
  line-height: 1;
}
/* Super variant: Diamond + Expert. Orange glow, accent border. */
.profile-badge--super {
  background: var(--accent-glow);
  border-color: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}
.profile-badge--super .profile-badge-icon { filter: drop-shadow(0 0 3px var(--accent-glow)); }
/* Per-camp tints for the icon (camp badges keep a soft language hint). */
.profile-badge[data-slug="camp_python"] .profile-badge-icon { color: var(--type-method); }
.profile-badge[data-slug="camp_csharp"] .profile-badge-icon { color: var(--type-class); }

/* Founder-only EF badge: solid orange disc + black bold "EF" letters.
   Recognisable from anywhere on the site; can't be earned, only granted. */
.profile-badge[data-slug="ef"] {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.profile-badge[data-slug="ef"] .profile-badge-icon {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #1a1816;
}

/* Owner-only "Manage badges" circle on the profile card. Same diameter as
   the chips so the row reads as one unit. Dashed border + accent pencil
   conveys it's editable, not part of the collection. Must sit AFTER the base
   .profile-badge rule (it only overrides background + border). */
.profile-badge--manage {
  background: transparent;
  border-style: dashed;
  border-color: var(--text-3);
  color: var(--text-3);
  padding: 0;
  cursor: pointer;
}
.profile-badge--manage:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.profile-badge--manage .profile-badge-icon { line-height: 0; }

/* Profile-card name-row: super badge gets the orange glow on the
   pinned chip too so it stands out vs plain achievements. */
.profile-badge[data-slug$="_diamond"] {
  background: var(--accent-glow);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
