/* 05 / Fit rules: the visitor's brief on the left, three sample leads re-scored on the right.
   Every rule is scoped under #icp. Bands: good var(--ok), possible var(--accent), poor var(--ash). */

#icp .sec-title .gold-i {
  display: inline-block;
}

/* ---------- Layout: brief (left) and leads (right); one column below 1024px ---------- */

#icp .lg-icp-in {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: stretch;
  column-gap: 28px;
  row-gap: 24px;
  padding: 28px;
}

#icp .lg-icp-brief,
#icp .lg-icp-leads {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

#icp .lg-icp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  min-height: 28px;
}

#icp .lg-icp-head-r {
  margin-left: auto;
  text-align: right;
}

/* ---------- Brief box: the textarea takes the height the leads column sets ---------- */

#icp .lg-icp-box {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: border-color 0.3s var(--ease-std), box-shadow 0.3s var(--ease-std);
}

#icp .lg-icp-box:focus-within {
  border-color: rgb(255 255 255 / 0.6);
  box-shadow: 0 0 0 3px rgb(255 255 255 / 0.12);
}

#icp .lg-icp-text {
  flex: 0 0 auto;
  display: block;
  width: 100%;
  min-height: 200px;
  margin: 0;
  padding: 16px 18px 8px;
  border: 0;
  outline: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  resize: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--bone);
  caret-color: var(--accent);
}

#icp .lg-icp-boxbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 8px 14px 10px;
  border-top: 1px solid var(--line);
}

#icp .lg-icp-hint {
  min-width: 0;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

#icp .lg-icp-reset {
  flex: none;
  font-size: 12px;
}

#icp .lg-icp-reset[hidden] {
  display: none;
}

/* ---------- Rules the AI checks ---------- */

#icp .lg-icp-found {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#icp .lg-icp-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#icp .lg-icp-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border: 1px solid rgb(255 255 255 / 0.4);
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--bone);
  animation: lg-icp-in 0.25s var(--ease-std) both;
}

#icp .lg-icp-chip svg {
  flex: none;
  width: 10px;
  height: 10px;
  color: var(--accent);
}

#icp .lg-icp-none {
  font-size: 12.5px;
}

@keyframes lg-icp-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Lead cards: absolutely placed so they glide to their new order ---------- */

#icp .lg-icp-list {
  position: relative;
  height: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

#icp .lg-icp-list.is-ready {
  transition: height 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

#icp .lg-icp-card {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  margin: 0;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  --lg-band: var(--ash);
  transition: border-color 0.4s var(--ease-std);
}

#icp .lg-icp-list.is-ready .lg-icp-card {
  transition: top 0.6s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.4s var(--ease-std);
}

#icp .lg-icp-card[data-lg-band="good"] { --lg-band: var(--ok); }
#icp .lg-icp-card[data-lg-band="mid"] { --lg-band: var(--accent); }
#icp .lg-icp-card[data-lg-band="poor"] { --lg-band: var(--ash); }
#icp .lg-icp-card[data-lg-band="none"] { --lg-band: var(--ash); }

#icp .lg-icp-card.is-top {
  border-color: rgb(255 255 255 / 0.55);
}

#icp .lg-icp-best {
  position: absolute;
  top: -9px;
  left: 14px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 0.3s var(--ease-std);
}

#icp .lg-icp-card.is-top .lg-icp-best {
  opacity: 1;
}

#icp .lg-icp-best[hidden] {
  display: none;
}

/* Gold shimmer on the top edge while the scores are on their way */
#icp .lg-icp-card.is-scoring::before {
  content: "";
  position: absolute;
  left: -1px;
  right: -1px;
  top: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: lg-icp-shine 1.1s linear infinite;
}

@keyframes lg-icp-shine {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

#icp .lg-icp-name {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--bone);
}

#icp .lg-icp-meta {
  margin: 6px 0 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  line-height: 1.5;
}

#icp .lg-icp-bar {
  position: relative;
  height: 4px;
  margin: 12px 0 10px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}

#icp .lg-icp-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: var(--lg-band);
  transition: width 0.5s var(--ease-std), background-color 0.4s var(--ease-std);
}

#icp .lg-icp-read {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--bone-70);
}

#icp .lg-icp-fit {
  font-family: var(--font-display);
  font-size: 17.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--lg-band);
}

/* ---------- Replay: bottom right of the leads column, its row kept so nothing jumps ---------- */

#icp .lg-icp-foot {
  display: flex;
  justify-content: flex-end;
  min-height: 40px;
  margin-top: auto;
}

#icp .lg-icp-replay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--bone);
  transition: border-color 0.2s, color 0.2s, opacity 0.3s;
}

#icp .lg-icp-replay[hidden] {
  display: inline-flex;
  visibility: hidden;
  pointer-events: none;
}

#icp .lg-icp-replay:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#icp .lg-icp-replay.is-busy {
  opacity: 0.45;
  pointer-events: none;
}

#icp .lg-icp-replay svg {
  width: 14px;
  height: 14px;
}

/* ---------- Under the stage: the spec line, centred on desktop ---------- */

#icp .lg-icp-line {
  max-width: 44rem;
  margin: 24px 0 0;
  text-align: left;
  text-wrap: balance;
}

@media (min-width: 1024px) {
  #icp .lg-icp-line {
    margin-inline: auto;
    text-align: center;
  }
}

/* ---------- One column below 1024px: brief first, then the leads ---------- */

@media (max-width: 1023px) {
  #icp .lg-icp-in {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 24px;
    padding: 18px;
  }

  #icp .lg-icp-box {
    flex: 0 0 auto;
  }
}

/* Phones: the mono labels stack, each flush left, instead of wrapping under the title (04-visual-14) */
@media (max-width: 640px) {
  #icp .lg-icp-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  #icp .lg-icp-head-r {
    margin-left: 0;
    text-align: left;
  }
}

@media (max-width: 600px) {
  #icp .lg-icp-text {
    font-size: 17.5px;
  }

  #icp .lg-icp-card {
    padding: 14px 14px;
  }
}
