/* GritHQ Profile page — authoritative stabilization layer.
   Profile landing and Training Profile editor fixes belong here during
   page-by-page finalization. Shared primitives stay in styles.css until the
   final whole-app consolidation. */

#view-profile{
  --profile-border:rgba(62,100,138,.42);
  --profile-panel:#08131e;
  --profile-panel-2:#0a1724;
  --profile-blue:#2f91ff;
  --profile-cyan:#25c9df;
  --profile-gold:#f2ba38;
  --profile-red:#ff6578;
  --profile-green:#49dc8d;
  --profile-muted:#91a1b3;
  min-width:0;
}

#view-profile.active{
  animation:none!important;
  contain:layout style;
  transform:none!important;
  will-change:auto!important;
}

#view-profile .gh-profile-head{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:center!important;
  gap:16px!important;
  margin:4px 2px 14px!important;
}

#view-profile .gh-profile-head h2{
  margin:3px 0 6px!important;
  letter-spacing:-.045em!important;
}

#view-profile .gh-profile-head .subtle{
  margin:0!important;
  max-width:56ch;
  color:var(--profile-muted)!important;
}

#view-profile .profile-avatar{
  width:58px;
  height:58px;
  border-radius:18px;
  display:grid;
  place-items:center;
  flex:0 0 auto;
  border:1px solid rgba(80,155,255,.42);
  background:linear-gradient(145deg,#225fc4,#16a8da);
  box-shadow:0 12px 28px rgba(26,102,211,.20),inset 0 1px 0 rgba(255,255,255,.18);
  color:#fff;
  font-size:18px;
  font-weight:900;
  letter-spacing:-.03em;
}

#view-profile .gh-profile-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:9px;
  margin:0;
}

#view-profile .gh-profile-row{
  appearance:none;
  width:100%;
  min-width:0;
  min-height:76px;
  display:grid;
  grid-template-columns:46px minmax(0,1fr) 18px;
  align-items:center;
  gap:12px;
  padding:11px 13px;
  border:1px solid var(--profile-border);
  border-radius:15px;
  background:linear-gradient(145deg,var(--profile-panel-2),var(--profile-panel));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.025);
  color:var(--text);
  text-align:left;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}

#view-profile .gh-profile-row:focus-visible,
#view-profile .gh-profile-quick:focus-visible{
  outline:2px solid var(--profile-blue);
  outline-offset:2px;
}

#view-profile .gh-profile-row-icon{
  width:42px;
  height:42px;
  border-radius:12px;
  display:grid;
  place-items:center;
  background:rgba(47,145,255,.10);
  color:#4c9eff;
  border:1px solid rgba(76,158,255,.18);
}

#view-profile .gh-profile-row-icon svg{
  width:22px;
  height:22px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

#view-profile .gh-profile-row-icon.equipment{color:var(--profile-gold);background:rgba(242,186,56,.08);border-color:rgba(242,186,56,.18)}
#view-profile .gh-profile-row-icon.goals{color:var(--profile-red);background:rgba(255,101,120,.08);border-color:rgba(255,101,120,.18);font-size:23px}
#view-profile .gh-profile-row-icon.injury{color:var(--profile-green);background:rgba(73,220,141,.08);border-color:rgba(73,220,141,.18);font-size:24px}

#view-profile .gh-profile-row>span:nth-child(2){
  display:grid;
  gap:4px;
  min-width:0;
}

#view-profile .gh-profile-row strong{
  font-size:15px!important;
  line-height:1.12;
}

#view-profile .gh-profile-row small{
  color:var(--profile-muted)!important;
  font-size:11.5px!important;
  line-height:1.28!important;
  white-space:normal!important;
  overflow:hidden;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}

#view-profile .gh-profile-row>b{
  color:#71869c;
  font-size:22px;
  font-weight:500;
  line-height:1;
  text-align:right;
}

#view-profile .gh-profile-quick-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:9px;
  margin-top:10px;
}

#view-profile .gh-profile-quick{
  min-width:0;
  min-height:112px;
  padding:13px;
  border:1px solid var(--profile-border);
  border-radius:15px;
  background:linear-gradient(145deg,#0a1826,#07131f);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.025);
  color:var(--text);
  text-align:left;
  display:grid;
  grid-template-rows:auto auto 1fr;
  align-content:start;
  gap:6px;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}

#view-profile .gh-profile-quick>span{
  width:38px;
  height:38px;
  border-radius:11px;
  display:grid;
  place-items:center;
  color:var(--profile-cyan);
  background:rgba(37,201,223,.08);
  border:1px solid rgba(37,201,223,.18);
}

#view-profile .gh-profile-quick.settings>span{
  color:#8d82ff;
  background:rgba(141,130,255,.08);
  border-color:rgba(141,130,255,.18);
}

#view-profile .gh-profile-quick svg{
  width:21px;
  height:21px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
}

#view-profile .gh-profile-quick strong{font-size:14px!important;line-height:1.12}
#view-profile .gh-profile-quick small{font-size:11px!important;line-height:1.32!important;color:var(--profile-muted)!important}

/* Training Profile editor. Keep one scroll owner and defer heavy searchable
   libraries until they approach the viewport. */
.training-profile-dialog{
  width:100vw!important;
  height:100dvh!important;
  max-width:none!important;
  max-height:none!important;
  overflow:hidden!important;
}

.training-profile-page{
  width:100%;
  height:100%;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior-y:contain;
  -webkit-overflow-scrolling:touch;
  scroll-behavior:auto!important;
}

.training-profile-page .profile-choice-group,
.training-profile-page .profile-section{
  content-visibility:auto;
  contain-intrinsic-size:auto 340px;
}

.training-profile-page .equipment-library,
.training-profile-page .injury-library{
  contain:layout style paint;
}

.training-profile-page .equipment-option,
.training-profile-page .injury-option{
  content-visibility:auto;
  contain-intrinsic-size:auto 54px;
}

.training-profile-page .profile-select-card,
.training-profile-page .equipment-option,
.training-profile-page .injury-option,
.training-profile-page .equipment-category-chip,
.training-profile-page .injury-category-chip,
.training-profile-page button{
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}

.training-profile-page .profile-choice-group{
  border-color:rgba(62,100,138,.38)!important;
  background:linear-gradient(145deg,rgba(10,23,36,.72),rgba(7,17,28,.76));
}

.training-profile-page .profile-choice-group>legend{
  color:#e9f1f8;
  font-weight:850;
}

.training-profile-page .equipment-category-chips,
.training-profile-page .injury-category-chips{
  overscroll-behavior-x:contain;
  scroll-snap-type:x proximity;
  scrollbar-width:none;
}
.training-profile-page .equipment-category-chips::-webkit-scrollbar,
.training-profile-page .injury-category-chips::-webkit-scrollbar{display:none}
.training-profile-page .equipment-category-chip,
.training-profile-page .injury-category-chip{scroll-snap-align:start}

.training-profile-page .profile-page-savebar{
  background:linear-gradient(to top,var(--bg) 82%,rgba(5,12,20,.94) 90%,rgba(5,12,20,0))!important;
}

@media(max-width:959px){
  #view-profile .gh-profile-head{margin-top:2px!important}
  #view-profile .gh-profile-row{min-height:74px;padding:10px 12px}
  #view-profile .gh-profile-quick{min-height:108px}

  .training-profile-page-inner{
    padding-left:max(16px,env(safe-area-inset-left))!important;
    padding-right:max(16px,env(safe-area-inset-right))!important;
  }
  .training-profile-page-head{
    margin:calc(-1 * (18px + env(safe-area-inset-top))) -2px 0!important;
    padding:calc(16px + env(safe-area-inset-top)) 2px 15px!important;
  }
  .training-profile-page-head h2{font-size:30px!important;line-height:1.08!important}
  .training-profile-page-head .subtle{font-size:14px!important;line-height:1.45!important}
  .training-profile-page .field>span,.training-profile-page label{font-size:14px}
  .training-profile-page input,.training-profile-page select{font-size:16px!important;min-height:48px!important}
  .training-profile-page .profile-choice-group{margin-top:18px!important}
  .training-profile-page .profile-check-row{font-size:15px}
}

@media(max-width:430px){
  #view-profile .gh-profile-head{gap:12px!important}
  #view-profile .profile-avatar{width:52px;height:52px;border-radius:16px;font-size:16px}
  #view-profile .gh-profile-row strong{font-size:14.5px!important}
  #view-profile .gh-profile-row small{font-size:11px!important}
  #view-profile .gh-profile-quick-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  #view-profile .gh-profile-quick{min-height:104px;padding:12px}
}

@media(max-width:379px){
  #view-profile .gh-profile-quick-grid{grid-template-columns:1fr!important}
  #view-profile .gh-profile-quick{min-height:92px}
}
