/* Agent profile — who the agent is, where it stands, what it has delivered. */

/* ── head ─────────────────────────────────────── */

.ag-head {
  position: relative;
  isolation: isolate;
  overflow: clip;
  margin: var(--tank-inset);
  border-radius: var(--r-tank);
  background: var(--surface);
  padding: calc(var(--header-h) + clamp(36px, 5vw, 64px)) 0 clamp(26px, 3.4vw, 40px);
}

.ag-crumbs {
  margin-bottom: 26px;
}

.ag-id {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 320px);
  gap: 24px clamp(32px, 5vw, 80px);
  align-items: center;
}

.ag-id__top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.ag-avatar {
  --size: 60px;
  color: var(--ink);
  background: var(--tint, var(--surface-2));
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--ink) 9%, transparent) inset;
  font-size: 1.5rem;
  font-weight: 680;
}

.ag-avatar:empty {
  background: var(--surface-2);
}

.ag-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 0.9375rem;
  font-weight: 560;
  color: var(--ink-2);
}

.ag-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink-3);
}

.ag-dot--online {
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--ok) 20%, transparent);
}

.ag-dot--working,
.ag-dot--away {
  background: var(--warn);
}

.ag-name {
  max-width: 17ch;
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  line-height: 0.96;
  font-weight: 690;
  font-stretch: var(--wdth-display);
  letter-spacing: var(--track-display);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.ag-name__skel {
  display: block;
  width: min(520px, 80%);
  height: 0.95em;
}

.ag-bio {
  max-width: 56ch;
  margin-top: 20px;
  font-size: var(--fs-body-l);
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}

.ag-bio:empty {
  display: none;
}

.ag-bio.is-placeholder {
  font-size: 1rem;
  color: var(--ink-3);
}

.ag-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.ag-facts:empty {
  display: none;
}

.ag-fact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 11px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 600;
}

.ag-fact .icon {
  width: 14px;
  height: 14px;
}

.ag-fact--ok {
  background: var(--ok-soft);
  color: color-mix(in oklab, var(--ok) 78%, var(--ink));
}

.ag-fact--warn {
  background: var(--warn-soft);
  color: color-mix(in oklab, var(--warn) 80%, var(--ink));
}

.ag-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  margin-top: 30px;
}

.ag-actions__own {
  font-weight: 600;
}

.ag-id__object {
  justify-self: end;
  width: min(320px, 100%);
  margin: 0;
  pointer-events: none;
}

.ag-id__object img {
  display: block;
  width: 100%;
  height: auto;
  transform: rotate(-9deg) translateY(4%);
  filter: drop-shadow(0 30px 46px rgb(11 34 48 / 0.16));
}

[data-theme="dark"] .ag-id__object img {
  filter: drop-shadow(0 30px 50px rgb(0 0 0 / 0.45)) saturate(0.9);
}

/* owner view */
.ag-owner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 24px;
  margin-top: 30px;
  padding: 16px 20px;
  border-radius: var(--r-card);
  background: var(--surface-2);
}

.ag-owner.is-pending {
  background: var(--warn-soft);
}

.ag-owner__text {
  flex: 1 1 360px;
  display: grid;
  gap: 4px;
}

.ag-owner__title {
  font-weight: 650;
}

.ag-owner__body {
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.ag-owner__note {
  font-size: 0.875rem;
  color: var(--ink-2);
}

.ag-owner__note strong {
  color: var(--ink);
}

/* track record: big thin numerals on hairlines */
.ag-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0 var(--gutter);
  margin: clamp(34px, 4.8vw, 60px) 0 0;
}

.ag-stat {
  display: grid;
  align-content: start;
  gap: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.ag-stat dt {
  order: 2;
  font-size: 0.875rem;
  font-weight: 580;
  color: var(--ink-2);
}

.ag-stat__v {
  order: 1;
  margin: 0;
  font-size: clamp(2rem, 3.3vw, 3rem);
  line-height: 1;
  font-weight: 380;
  font-stretch: 84%;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.ag-stat__note {
  order: 3;
  margin: 0;
  font-size: 0.8125rem;
  color: var(--ink-3);
}

/* ── editorial sections ──────────────────────── */

.ag-body {
  padding-top: clamp(44px, 6vw, 84px);
}

.ag-sec {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 22px var(--gutter);
  padding-block: clamp(30px, 4.2vw, 52px);
  border-top: 1px solid var(--line);
}

.ag-sec:first-child {
  padding-top: 0;
  border-top: 0;
}

.ag-sec__label {
  display: grid;
  align-content: start;
  gap: 10px;
  max-width: 34ch;
}

.ag-sec__title {
  font-size: 1.375rem;
  line-height: 1.2;
  font-weight: 650;
  font-stretch: 92%;
  letter-spacing: -0.012em;
}

.ag-sec__lede {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink-2);
}

/* ── the reputation ladder ───────────────────── */

.ag-scale {
  position: relative;
}

.ag-rungs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0 6px;
}

.ag-rung {
  --fill: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
}

.ag-rung__name {
  font-size: 0.9375rem;
  font-weight: 620;
  font-stretch: 94%;
  color: var(--ink-3);
}

.ag-rung__range {
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.ag-rung__track {
  position: relative;
  height: 6px;
  margin-top: 12px;
  border-radius: 3px;
  background: var(--line-soft);
  box-shadow: 0 0 0 1px var(--line) inset;
}

.ag-rung__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--fill) * 100%);
  border-radius: inherit;
  background: var(--ink);
  transition: width var(--t-slow) var(--ease-out);
}

.ag-rung.is-past .ag-rung__name,
.ag-rung.is-past .ag-rung__range {
  color: var(--ink-2);
}

.ag-rung.is-now .ag-rung__name {
  color: var(--ink);
}

.ag-rung.is-now .ag-rung__range {
  color: var(--ink-2);
}

.ag-rung.is-now .ag-rung__fill {
  background: var(--accent);
}

/* the marker sits on the current rung; its coral hairline drops to the callout */
.ag-marker {
  position: absolute;
  top: 50%;
  left: calc(var(--fill) * 100%);
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 9px color-mix(in oklab, var(--accent) 18%, transparent);
  transition: left var(--t-slow) var(--ease-out);
}

.ag-callout {
  --left: 0px;
  --lead-x: 24px;
  position: relative;
  width: min(380px, 100%);
  margin: 30px 0 0 var(--left);
  padding: 18px 20px 16px;
  border-radius: var(--r-card);
  background: var(--surface);
}

.ag-callout:empty {
  display: none;
}

.ag-callout::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: var(--lead-x);
  width: 1px;
  height: 30px;
  background: var(--accent);
}

.ag-callout__rep {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.ag-callout__n {
  font-size: 2rem;
  line-height: 1;
  font-weight: 420;
  font-stretch: 84%;
  letter-spacing: -0.035em;
}

.ag-callout__tier {
  font-weight: 650;
}

.ag-callout__next {
  margin-top: 8px;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.ag-callout__level {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.875rem;
  color: var(--ink-3);
}

@media (prefers-reduced-motion: reduce) {
  .ag-rung__fill,
  .ag-marker {
    transition: none;
  }
}

/* ── settled work ────────────────────────────── */

.ag-work {
  display: grid;
}

.ag-work__row {
  position: relative;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto;
  gap: 4px 22px;
  align-items: baseline;
  padding: 15px 0;
  border-top: 1px solid var(--line-soft);
}

/* no acceptance dates in the payload: title, category and amount only */
.ag-work--undated .ag-work__row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.ag-work__row:first-child {
  border-top: 0;
  padding-top: 0;
}

.ag-work__date {
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.ag-work__main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.ag-work__title {
  font-size: 1rem;
  line-height: 1.4;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ag-work__link {
  color: inherit;
  text-decoration: none;
}

.ag-work__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
}

.ag-work__link:focus-visible {
  outline: none;
}

.ag-work__link:focus-visible::after {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.ag-work__row:hover .ag-work__title {
  color: var(--link);
}

.ag-work__cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.ag-work__cat::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot, var(--ink-3));
}

.ag-work__amt {
  font-size: 1.0625rem;
  font-weight: 540;
  text-align: right;
  white-space: nowrap;
}

.ag-work__foot {
  margin-top: 14px;
  font-size: 0.875rem;
  color: var(--ink-3);
}

.ag-empty {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border-radius: var(--r-card);
  background: var(--surface);
}

.ag-empty__title {
  font-weight: 650;
}

.ag-empty__body {
  font-size: 0.9375rem;
  color: var(--ink-2);
}

/* ── capabilities ────────────────────────────── */

.ag-cap {
  display: grid;
  margin: 0;
}

.ag-cap > div {
  display: grid;
  grid-template-columns: minmax(130px, 200px) minmax(0, 1fr);
  gap: 6px 24px;
  padding: 15px 0;
  border-top: 1px solid var(--line-soft);
}

.ag-cap > div:first-child {
  border-top: 0;
  padding-top: 0;
}

.ag-cap dt {
  font-size: 0.875rem;
  font-weight: 580;
  color: var(--ink-3);
}

.ag-cap dd {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  color: var(--ink);
}

.ag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line) inset;
  font-size: 0.875rem;
  font-weight: 560;
}

.ag-pill--cat::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--dot);
}

.ag-model {
  font-weight: 600;
}

.ag-muted {
  color: var(--ink-3);
}

.ag-score {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.ag-score__bar {
  position: relative;
  width: 140px;
  height: 6px;
  border-radius: 3px;
  background: var(--line-soft);
  overflow: hidden;
}

.ag-score__bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--score) * 1%);
  border-radius: inherit;
  background: var(--link);
}

/* ── keep browsing ───────────────────────────── */

.ag-next {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  padding: clamp(24px, 3vw, 36px) 0 clamp(8px, 2vw, 24px);
  border-top: 1px solid var(--line);
  font-weight: 600;
}

/* ── not available ───────────────────────────── */

.ag-gone {
  padding-block: clamp(8px, 2vw, 24px) var(--section-tight);
}

.ag-gone__panel {
  display: grid;
  justify-items: start;
  gap: 16px;
  max-width: 620px;
  padding: clamp(24px, 3.4vw, 40px);
  border-radius: var(--r-panel);
  background: var(--surface);
}

.ag-gone__panel img {
  width: 120px;
  height: auto;
}

.ag-gone__body {
  font-size: var(--fs-body-l);
  line-height: 1.55;
  color: var(--ink-2);
}

.ag-gone__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
}

.ag.is-gone .ag-id__object {
  display: none;
}

/* ── responsive ──────────────────────────────── */

@media (max-width: 1100px) {
  .ag-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 22px;
  }
}

@media (max-width: 900px) {
  .ag-id {
    grid-template-columns: minmax(0, 1fr) 150px;
  }

  .ag-sec {
    grid-template-columns: 1fr;
  }

  .ag-sec__label {
    max-width: 60ch;
  }
}

@media (max-width: 640px) {
  .ag-id {
    grid-template-columns: 1fr;
  }

  .ag-id__object {
    position: absolute;
    top: calc(var(--header-h) + 18px);
    right: -24px;
    width: 128px;
    opacity: 0.9;
    z-index: -1;
  }

  .ag-avatar {
    --size: 52px;
    font-size: 1.3rem;
  }

  .ag-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .ag-actions .btn {
    justify-content: center;
  }

  .ag-actions__own {
    align-self: flex-start;
  }

  .ag-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ag-stat__v {
    font-size: 2.1rem;
  }

  /* the ladder stands up on a phone: Legend at the top */
  .ag-rungs {
    display: flex;
    flex-direction: column-reverse;
    gap: 0;
  }

  .ag-rung {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0 14px;
    min-height: 46px;
  }

  .ag-rung__name {
    grid-column: 2;
    grid-row: 1;
  }

  .ag-rung__range {
    grid-column: 3;
    grid-row: 1;
  }

  .ag-rung__track {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
    align-self: stretch;
    width: 6px;
    height: auto;
    margin: 2px 0;
  }

  .ag-rung__fill {
    inset: auto 0 0 0;
    width: auto;
    height: calc(var(--fill) * 100%);
    transition-property: height;
  }

  .ag-marker {
    top: auto;
    left: 50%;
    bottom: calc(var(--fill) * 100%);
    margin: 0 0 -8px -8px;
    transition-property: bottom;
  }

  .ag-callout {
    width: 100%;
    margin: 18px 0 0;
    background: var(--surface);
    border-left: 2px solid var(--accent);
    border-radius: 0 var(--r-card) var(--r-card) 0;
  }

  .ag-callout::before {
    display: none;
  }

  .ag-work__row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .ag-work__date {
    grid-column: 1 / -1;
  }

  .ag-cap > div {
    grid-template-columns: 1fr;
  }
}
