/* Shared profile chrome contract for killclog.com.
   Loaded from /p/, /c/, and / (root players). Single source of truth so the
   player and clan routes can't drift apart on:
     - outer chrome shell (gradient fill, rim border, rounded corners,
       inset highlight, drop shadow)
     - inside-edge rim against the black wells (search, activity sections,
       boss grid) - the same border the outer chrome uses
     - search frame focus highlight
     - activity tray + boss grid visual rhythm
     - dormant tray + grid treatment
   Route-specific content (clan identity card, leaderboards, podiums, player
   tracker, etc.) stays in /c/ and /p/. Anything chrome-shaped lives here. */

#kc-profile .profile-chrome-shell {
  --profile-chrome-fill: linear-gradient(
    180deg,
    rgba(255, 173, 0, 0.075) 0%,
    rgba(255, 87, 0, 0.055) 48%,
    rgba(255, 87, 0, 0.038) 100%
  );
  --profile-chrome-border: rgba(255, 173, 0, 0.18);
  --profile-chrome-edge: rgba(255, 210, 112, 0.15);
  width: min(100%, 242px);
  margin: 0 auto;
  box-sizing: border-box;
  background: var(--profile-chrome-fill);
  border: 1px solid var(--profile-chrome-border);
  border-radius: 3px;
  box-shadow:
    0 18px 30px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 var(--profile-chrome-edge),
    inset 1px 0 0 rgba(255, 173, 0, 0.07),
    inset -1px 0 0 rgba(255, 87, 0, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.52);
  padding-bottom: 11px;
}
#kc-profile .profile-chrome-zone {
  width: 100%;
  box-sizing: border-box;
  background: transparent;
}
#kc-profile .profile-search-chrome {
  padding: 8px 10px 3px;
}
#kc-profile .profile-grid-shell {
  width: 100%;
  margin: 0 auto;
  padding: 0 10px 10px;
  box-sizing: border-box;
  background: transparent;
}

/* Search bar (the well is .search-container - black background, rimmed
   with the same border the outer chrome uses, so inside edges match). */
#kc-profile .search-wrap {
  display: flex; justify-content: center;
  margin-bottom: 0; padding-top: 0;
}
#kc-profile .search-container {
  position: relative;
  display: block;
  width: 220px;
  height: 30px;
  background: #000;
  border: 1px solid var(--profile-chrome-border, rgba(255, 173, 0, 0.18));
  box-sizing: border-box;
}
#kc-profile .search-input {
  width: 100%; height: 100%;
  background: transparent; border: 0; border-radius: 0;
  color: var(--kc4); font-family: 'RuneScape', sans-serif; font-size: 16px;
  padding: 0 30px 0 31px; outline: none;
}
#kc-profile .search-container:focus-within {
  box-shadow: inset 0 0 0 1px rgba(202, 255, 0, 0.22);
}
#kc-profile .search-input::placeholder { color: var(--amber-dim); }
#kc-profile .search-wrap .mag {
  position: absolute; left: 8px; top: 50%;
  transform: translateY(-50%); pointer-events: none;
  width: 15px; height: 15px;
}
#kc-profile .search-wrap .mag circle,
#kc-profile .search-wrap .mag line,
#kc-profile .search-wrap .mag path {
  stroke: rgba(125, 125, 125, 0.68); fill: none; stroke-width: 1.5;
}
#kc-profile .search-container:focus-within .mag circle,
#kc-profile .search-container:focus-within .mag line,
#kc-profile .search-container:focus-within .mag path {
  stroke: rgba(150, 150, 150, 0.76);
}
#kc-profile .search-wrap .mag .mag-compare { opacity: 0; }
#kc-profile .search-container.compare-active .mag .mag-normal { opacity: 0; }
#kc-profile .search-container.compare-active .mag .mag-compare { opacity: 1; }
#kc-profile .search-container.compare-active .mag .cm-left { stroke: rgb(91, 164, 207); }
#kc-profile .search-container.compare-active .mag .cm-right { stroke: #e05656; }
#kc-profile .search-container.is-searching .mag {
  border: 1.5px solid rgba(125, 125, 125, 0.28);
  border-top-color: rgba(150, 150, 150, 0.76);
  border-radius: 50%;
  box-sizing: border-box;
  animation: kcSearchIconSpin 0.75s linear infinite;
}
#kc-profile .search-container.is-searching .mag circle,
#kc-profile .search-container.is-searching .mag line,
#kc-profile .search-container.is-searching .mag path,
#kc-profile .search-container.is-searching .mag g { opacity: 0; }
@keyframes kcSearchIconSpin { to { transform: translateY(-50%) rotate(360deg); } }
#kc-profile .search-error {
  color: #ff4444; font-size: 12px; text-align: center;
  height: 0; margin-top: 0; overflow: hidden;
}
#kc-profile .search-error:not(:empty) {
  height: 16px; margin: 2px 0 6px; overflow: visible;
}
#kc-profile .search-status {
  color: rgb(160, 160, 160);
  font-family: 'RuneScape Small', sans-serif;
  font-size: 14px;
  text-align: left;
  width: 220px;
  box-sizing: border-box;
  padding-left: 4px;
  min-height: 18px;
  margin: 0 auto 5px;
  letter-spacing: 0;
}

/* Compare clog totals above the search bar. The band is created as soon as
   compare entry starts, so loading the rival total does not push the search
   well down a second time. The tier icon uses the same 14px sprite footprint
   as the single-player clog-tier button. */
#kc-profile .profile-search-chrome .clog-totals-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 220px;
  min-height: 15px;
  margin: 0 auto 4px;
  font-family: 'RuneScape Small', sans-serif;
  font-size: 14px;
  line-height: 15px;
}
#kc-profile .profile-search-chrome .clog-totals-bar .ct-side {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 15px;
  line-height: 15px;
}
#kc-profile .profile-search-chrome .clog-totals-bar .tier-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  object-fit: contain;
  image-rendering: pixelated;
  vertical-align: middle;
}
#kc-profile .profile-search-chrome .clog-totals-bar .ct-blue { color: rgb(91, 164, 207); }
#kc-profile .profile-search-chrome .clog-totals-bar .ct-red { color: #e05656; }

/* Refresh overlay - centered in the chrome band above the search well, hover-only,
   after lookup. It stays inside the 242px chrome instead of hanging off the rim. */
#kc-profile .refresh-overlay {
  position: absolute; left: 50%; right: auto; top: -12px;
  transform: translate(-50%, -50%);
  width: 16px; height: 16px;
  color: var(--amber); font-size: 14px; line-height: 1;
  opacity: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s, color 0.15s, transform 0.3s;
  user-select: none;
}
#kc-profile .search-container.has-player .refresh-overlay,
#kc-profile .search-container.can-refresh .refresh-overlay { pointer-events: auto; }
#kc-profile .search-container.has-player:hover .refresh-overlay,
#kc-profile .search-container.can-refresh:hover .refresh-overlay,
#kc-profile .refresh-overlay:hover { opacity: 1; }
#kc-profile .refresh-overlay:hover { color: var(--amber-soft); }
#kc-profile .refresh-overlay:active { color: var(--emerald); }
#kc-profile .refresh-overlay.spinning { transform: translate(-50%, -50%) rotate(360deg); }
#kc-profile .search-container.compare-active .refresh-overlay { display: none; }

/* Compare icon - inset to mirror the left search magnifier.
   Plugin parity: normal state shows the compare glyph on the right; compare
   entry/active mode swaps it to the neutral search glyph. */
#kc-profile .search-compare-icon {
  position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease;
  display: flex; align-items: center; justify-content: center;
}
#kc-profile .search-compare-icon svg { width: 14px; height: 14px; display: block; }
#kc-profile .search-compare-icon .cm-left { stroke: rgb(91, 164, 207); fill: none; stroke-width: 1.5; }
#kc-profile .search-compare-icon .cm-right { stroke: #e05656; fill: none; stroke-width: 1.5; }
#kc-profile .search-compare-icon .cm-search circle,
#kc-profile .search-compare-icon .cm-search line {
  stroke: rgba(125, 125, 125, 0.7); fill: none; stroke-width: 1.5;
}
#kc-profile .search-compare-icon .cm-search { opacity: 0; }
#kc-profile .search-container.compare-active .search-compare-icon .cm-compare { opacity: 0; }
#kc-profile .search-container.compare-active .search-compare-icon .cm-search { opacity: 1; }
#kc-profile .search-container.compare-active .search-compare-icon:hover .cm-search circle,
#kc-profile .search-container.compare-active .search-compare-icon:hover .cm-search line,
#kc-profile .search-container.compare-active .search-compare-icon.active .cm-search circle,
#kc-profile .search-container.compare-active .search-compare-icon.active .cm-search line {
  stroke: rgba(150, 150, 150, 0.86);
}
#kc-profile .search-container.has-player .search-compare-icon { opacity: 0.55; pointer-events: auto; }
#kc-profile .search-compare-icon:hover { opacity: 1; }
#kc-profile .search-compare-icon.active { opacity: 1; }
#kc-profile .search-container.has-player .search-input { padding-right: 28px; }

/* Compare entry mode - red rival input, without route-specific border drift. */
#kc-profile .search-container:has(.search-input.compare-entry) {
  box-shadow: inset 0 0 0 1px rgba(224, 86, 86, 0.45);
}
#kc-profile .search-input.compare-entry {
  color: #e05656;
  caret-color: #e05656;
}
#kc-profile .search-input.compare-entry::placeholder { color: rgba(224, 86, 86, 0.5); }

/* Activities tray - hidden by default, slides open from the hamburger.
   150ms ease-out matches the plugin's tray animation. Each .activity-section
   is a black well with the same rim as the outer chrome. */
#kc-profile .activities-tray {
  overflow: hidden;
  max-height: 0; opacity: 0;
  width: 220px; margin: 0 auto;
  transition: max-height 0.15s ease-out, opacity 0.15s ease-out, margin-bottom 0.15s ease-out;
}
#kc-profile .activities-tray.open { max-height: 320px; opacity: 1; margin-bottom: 4px; }
#kc-profile .activity-section {
  background: #000;
  border: 1px solid var(--profile-chrome-border, rgba(255, 173, 0, 0.18));
}
#kc-profile .activity-section + .activity-section { margin-top: 4px; }
#kc-profile .activity-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  margin-bottom: 0;
}
/* Mirrors .boss-cell so the tray + boss grid read as one visual rhythm. */
#kc-profile .activity-cell {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 5px 1px;
  border: 1px solid transparent; transition: background 0.1s;
  color: var(--amber-soft);
}
@media (hover: hover) {
  #kc-profile .activity-cell:hover { background: rgba(255, 255, 255, 0.1); }
}
#kc-profile .activity-cell .ac-icon { width: 20px; height: 20px; flex-shrink: 0; }
#kc-profile .activity-cell .ac-icon-combat { transform: scale(1.7); transform-origin: center; }
#kc-profile .activity-cell .ac-icon-clan-clog { object-fit: contain; image-rendering: pixelated; }
#kc-profile .activity-cell .ac-count {
  font-family: 'RuneScape Small', sans-serif; font-size: 16px;
  color: var(--amber-soft); white-space: pre;
}
#kc-profile .activity-cell.ac-k1 .ac-count { color: var(--kc1); }
#kc-profile .activity-cell.ac-k2 .ac-count { color: var(--kc2); }
#kc-profile .activity-cell.ac-k3 .ac-count { color: var(--kc3); }
#kc-profile .activity-cell.ac-k4 .ac-count { color: var(--kc4); }

/* Boss grid - black well rimmed with the same chrome border. */
#kc-profile .boss-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0; width: 220px; margin: 0 auto; padding-top: 0;
  animation: fadeIn 0.2s ease-out;
  background: #000;
  border: 1px solid var(--profile-chrome-border, rgba(255, 173, 0, 0.18));
}
#kc-profile .boss-cell {
  display: flex; align-items: center; justify-content: center;
  padding: 5px 1px;
  border: 1px solid transparent; transition: background 0.1s;
  color: var(--kc-color, #FF5700);
}
@media (hover: hover) {
  #kc-profile .boss-cell:hover { background: rgba(255, 255, 255, 0.1); }
}
#kc-profile .boss-cell.active { background: rgba(255, 255, 255, 0.1); }
#kc-profile .boss-cell .cell-group {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  width: 100%;
}
#kc-profile .boss-cell img { width: 20px; height: 20px; flex-shrink: 0; }
#kc-profile .boss-cell.dim img { opacity: 0.35; }
#kc-profile .boss-cell .kc {
  font-family: 'RuneScape Small', sans-serif; font-size: 16px;
  color: var(--kc-color, #FF5700); white-space: pre;
}

/* Dormant tray + boss grid. */
#kc-profile .activities-tray.dormant .activity-cell {
  cursor: default;
  color: transparent;
}
#kc-profile .activities-tray.dormant .activity-cell:hover { background: transparent; }
#kc-profile .activities-tray.dormant .activity-cell .ac-icon {
  opacity: 0.4;
  filter: drop-shadow(0 0 4px rgba(78, 240, 21, 0.22));
  transition: opacity 0.24s ease-out, filter 0.24s ease-out;
}
#kc-profile .activities-tray.dormant .activity-cell .dormant-kc-placeholder { visibility: hidden; }
#kc-profile .boss-grid.dormant { animation: none; }
#kc-profile .boss-cell.dormant { color: transparent; }
#kc-profile .boss-cell.dormant img {
  opacity: 0.4;
  filter: drop-shadow(0 0 4px rgba(78, 240, 21, 0.22));
  transition: opacity 0.24s ease-out, filter 0.24s ease-out;
}
#kc-profile .boss-cell.dormant .dormant-kc-placeholder { visibility: hidden; }
#kc-profile .boss-grid.dormant.loading { animation: kcDormantPulse 1.5s ease-in-out infinite; }
@keyframes kcDormantPulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
#kc-profile .boss-grid:not(.dormant) { animation: kcWake 0.24s ease-out; }
@keyframes kcWake {
  from { opacity: 0.55; filter: brightness(0.7); }
  to { opacity: 1; filter: brightness(1); }
}
@media (prefers-reduced-motion: reduce) {
  #kc-profile .boss-grid.dormant.loading,
  #kc-profile .boss-grid:not(.dormant) { animation: none; }
  #kc-profile .boss-cell.dormant img { transition: none; }
  #kc-profile .activities-tray.dormant .activity-cell .ac-icon { transition: none; }
}
