/* Model Change Intelligence (/feed). Builds on home.css tokens. */

/* Title + stats */
.pd-feed-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: start;
  padding-top: 40px;
}
.pd-feed-intro h1 {
  margin: 4px 0 12px; font-size: 46px; line-height: 1.08; font-weight: 800; letter-spacing: -0.03em; color: var(--pd-ink);
}
.pd-feed-intro p { margin: 0; max-width: 700px; font-size: 16px; line-height: 1.5; color: var(--pd-ink-2); }

.pd-feed-stats { display: grid; grid-template-columns: repeat(3, 170px); gap: 10px; }
.pd-stat {
  display: flex; align-items: center; gap: 11px; height: 92px; padding: 0 14px;
  border-radius: 10px; box-shadow: 0 1px 2px rgba(15, 30, 80, .03);
}
.pd-stat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.pd-stat strong { display: block; font-size: 24px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.pd-stat span:not(.pd-stat-icon) { display: block; margin-top: 3px; font-size: 11.5px; line-height: 1.3; white-space: nowrap; color: var(--pd-ink-2); }

/* Toolbar */
.pd-toolbar {
  margin-top: 26px; display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: 10px; box-shadow: 0 1px 2px rgba(15, 30, 80, .03);
}
.pd-toolbar-search { position: relative; flex: 0 1 600px; min-width: 0; }
.pd-toolbar-search .pd-search-field { height: 44px; }
.pd-toolbar-search .pd-suggest {
  position: absolute; z-index: 30; top: 100%; left: 0; right: 0; margin-top: 6px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .12);
}
.pd-select { position: relative; flex: 0 0 152px; color: var(--pd-ink-2); }
.pd-select select {
  width: 100%; height: 44px; padding: 0 30px 0 13px; appearance: none; -webkit-appearance: none;
  background: #fff; border: 1px solid #D9E0EC; border-radius: var(--pd-radius-sm);
  font: 500 13px var(--pd-font); color: var(--pd-ink); cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pd-select select:hover { border-color: #C3CDE0; }
.pd-select select:focus { outline: 0; border-color: var(--pd-blue); box-shadow: 0 0 0 4px rgba(59, 69, 255, .12); }
.pd-select .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.pd-toolbar-clear {
  margin-left: auto; height: 44px; min-width: 92px; background: #F4F6FA; border: 1px solid #DDE3EE;
  color: var(--pd-ink) !important; font-weight: 500;
}
.pd-toolbar-clear:hover { border-color: #C3CDE0; background: #EEF1F7; }
.pd-toolbar-btn { height: 44px; }

/* Results */
.pd-feed-results { margin-top: 14px; transition: opacity .15s ease; }
.pd-feed-results.is-loading { opacity: .55; pointer-events: none; }
.pd-events { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.pd-event {
  display: grid; grid-template-columns: 320px minmax(0, 1fr) auto; align-items: center;
  min-height: 108px; padding: 20px 24px; border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 30, 80, .03);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pd-event:hover { border-color: #CBD3FF; box-shadow: var(--pd-shadow); }

.pd-event-id {
  display: flex; align-items: center; gap: 16px; min-width: 0; align-self: stretch;
  padding-right: 20px; border-right: 1px solid var(--pd-line);
}
.pd-avatar {
  width: 52px; height: 52px; border-radius: 10px; flex: none; display: grid; place-items: center;
  color: #fff; font-size: 21px; font-weight: 800; letter-spacing: -0.02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.pd-avatar { position: relative; overflow: hidden; }
.pd-avatar img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  background: #fff; border: 1px solid var(--pd-line); border-radius: inherit;
}
.pd-avatar-0 { background: linear-gradient(135deg, #1F2937, #0B1220); }
.pd-avatar-1 { background: linear-gradient(135deg, #6A5CFF, #3B45FF); }
.pd-avatar-2 { background: linear-gradient(135deg, #F0354F, #D11F3A); }
.pd-avatar-3 { background: linear-gradient(135deg, #14B8A6, #0D9488); }
.pd-avatar-4 { background: linear-gradient(135deg, #7B4DFF, #5B2EE8); }
.pd-avatar-5 { background: linear-gradient(135deg, #1AA0F0, #1668E3); }
.pd-event-id-text { min-width: 0; }
.pd-event-id h2 { margin: 0; font-size: 15.5px; line-height: 1.3; font-weight: 700; overflow-wrap: break-word; }
.pd-event-id h2 a:hover { color: var(--pd-blue); }
.pd-event-id time { display: block; margin-top: 4px; font-size: 12.5px; color: var(--pd-ink-3); }
.pd-event-id .pd-dot-sep { margin: 0 6px; }

.pd-event-main { display: flex; align-items: flex-start; gap: 20px; min-width: 0; padding: 0 20px 0 22px; }
.pd-event-body { flex: 1; min-width: 0; }
.pd-event-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; line-height: 1.3; font-weight: 700; }
.pd-event-icon { color: var(--pd-ink); }
.pd-event-desc { margin: 5px 0 0 30px; font-size: 13.5px; line-height: 1.45; color: var(--pd-ink-2); }

.pd-sev {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 5px;
  font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap;
}
.pd-sev-critical { background: var(--pd-danger-pale); color: var(--pd-danger-ink); }
.pd-sev-critical::before, .pd-sev-low::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pd-sev-high { background: #FFEEF1; color: var(--pd-danger-ink); }
.pd-sev-medium { background: var(--pd-warn-pale); color: var(--pd-warn-ink); }
.pd-sev-low { background: var(--pd-blue-pale); color: var(--pd-blue-2); }

.pd-event-types { flex: 0 0 170px; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 1px; }
.pd-type {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 5px;
  background: #F4F6FA; border: 1px solid #E3E8F1; color: var(--pd-ink-2);
  font-size: 11.5px; font-weight: 500; line-height: 18px; white-space: nowrap;
}

.pd-inline-diff { display: flex; align-items: center; gap: 12px; margin: 10px 0 0 30px; flex-wrap: wrap; }
.pd-inline-diff > span {
  display: inline-flex; justify-content: center; min-width: 116px; max-width: 100%; padding: 3px 14px; border-radius: 5px;
  font-size: 12.5px; font-weight: 500; line-height: 20px; overflow-wrap: anywhere;
}
.pd-inline-from { background: #FFE9EC; color: var(--pd-danger-ink); }
.pd-inline-to { background: #E4F8EE; color: var(--pd-success-ink); }
.pd-inline-arrow { color: var(--pd-ink-3); }

.pd-event-details {
  list-style: none; margin: 10px 0 0 30px; padding: 8px 14px; max-width: 560px;
  background: #F7F9FC; border: 1px solid var(--pd-line-2); border-radius: 6px;
  display: grid; gap: 3px;
}
.pd-event-details li {
  position: relative; padding-left: 14px; font-size: 12px; line-height: 1.5; color: var(--pd-ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pd-event-details li::before { content: "•"; position: absolute; left: 2px; color: var(--pd-ink-3); }
.pd-event-details code { font-family: var(--pd-mono); font-size: 11.5px; color: var(--pd-ink); }
.pd-event-details li > span { color: var(--pd-ink-3); }

.pd-event-actions { display: flex; gap: 8px; }
.pd-act {
  display: inline-flex; align-items: center; justify-content: center; height: 36px; min-width: 80px; padding: 0 16px;
  border-radius: 7px; background: #fff; border: 1px solid #D9E0EC; color: var(--pd-ink);
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.pd a.pd-act:hover { border-color: var(--pd-blue); color: var(--pd-blue); }
.pd .pd-act-view { min-width: 68px; background: var(--pd-blue-pale); border-color: #D5DCFF; color: var(--pd-blue); font-weight: 600; }
.pd .pd-act-view:hover { background: #E3E8FF; }
.pd-act-watch { background: #F4F6FA; }

/* Recorded dependency revision (pinned / floating / unknown) and exposure to a change */
.pd-rev, .pd-exp {
  display: inline-block; padding: 1px 8px; border-radius: 5px; border: 1px solid transparent;
  font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap; vertical-align: middle;
}
.pd-rev-pinned { background: var(--pd-success-pale); color: var(--pd-success-ink); border-color: #BDEBD5; }
.pd-rev-floating { background: var(--pd-warn-pale); color: var(--pd-warn-ink); border-color: #FFE1B3; }
.pd-rev-unknown { background: #F1F4F9; color: var(--pd-ink-2); border-color: var(--pd-line); }
.pd-exp-warn { background: var(--pd-warn-pale); color: var(--pd-warn-ink); border-color: #FFE1B3; }
.pd-exp-success { background: var(--pd-success-pale); color: var(--pd-success-ink); border-color: #BDEBD5; }
.pd-exp-neutral { background: #F1F4F9; color: var(--pd-ink-2); border-color: var(--pd-line); }

/* "Which revision are you using?" fields */
.pd-revq { flex: 1 1 100%; min-width: 0; margin: 0; padding: 0; border: 0; }
.pd-revq legend { padding: 0; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--pd-ink); }
.pd-revq-fields { display: flex; flex-wrap: wrap; gap: 8px; }
.pd .pd-revq select, .pd .pd-revq input {
  height: 38px; padding: 0 10px; border: 1px solid #D5DCE8; border-radius: var(--pd-radius-sm);
  background: #fff; font: 400 13.5px var(--pd-font); color: var(--pd-ink);
}
.pd .pd-revq select { flex: 0 1 190px; }
.pd .pd-revq input { flex: 1 1 160px; min-width: 0; width: auto; font-family: var(--pd-mono); }
.pd-revq select:focus, .pd-revq input:focus { outline: 2px solid var(--pd-blue); outline-offset: 1px; border-color: transparent; }
.pd-revq[disabled] { opacity: .55; }
.pd-actions form .pd-revq { margin-top: 10px; }
.pd-act.is-disabled { color: var(--pd-ink-3); background: #FAFBFD; cursor: not-allowed; }
.pd a:focus-visible, .pd button:focus-visible, .pd .pd-act:focus-visible {
  outline: 2px solid var(--pd-blue); outline-offset: 2px;
}

/* Empty / error */
.pd-feed-state { padding: 44px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.pd-feed-state-icon { width: 54px; height: 54px; padding: 14px; border-radius: 50%; }
.pd-feed-state h2 { margin: 16px 0 4px; font-size: 18px; font-weight: 700; }
.pd-feed-state p { margin: 0 0 18px; font-size: 14px; color: var(--pd-ink-2); }

/* Pagination */
.pd-pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 26px 0 8px; }
.pd-page {
  min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; background: #fff; border: 1px solid var(--pd-line); color: var(--pd-ink);
  font-size: 13.5px; font-weight: 500; transition: border-color .15s ease, color .15s ease;
}
.pd a.pd-page:hover { border-color: var(--pd-blue); color: var(--pd-blue); }
.pd-page.is-current { background: var(--pd-blue); border-color: var(--pd-blue); color: #fff; font-weight: 600; }
.pd-page.is-gap { border-color: transparent; background: transparent; min-width: 20px; padding: 0; color: var(--pd-ink-3); }
.pd-page.is-disabled { color: #B8C1D1; }

/* Responsive */
@media (max-width: 1200px) {
  .pd-feed-intro h1 { font-size: 42px; }
  .pd-feed-stats { grid-template-columns: repeat(3, 160px); }
  .pd-event { grid-template-columns: 260px minmax(0, 1fr) auto; }
  .pd-event-types { flex-basis: 130px; }
}

@media (max-width: 1100px) {
  .pd-feed-head { grid-template-columns: 1fr; gap: 22px; }
  .pd-feed-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pd-toolbar { flex-wrap: wrap; }
  .pd-toolbar-search { flex: 1 0 100%; }
  .pd-select { flex: 1 1 150px; }
  .pd-toolbar-clear { margin-left: 0; }
  .pd-event-main { flex-direction: column-reverse; gap: 10px; }
  .pd-event-types { flex-basis: auto; }
}

@media (max-width: 860px) {
  .pd-event { grid-template-columns: 1fr; gap: 16px; padding: 18px; }
  .pd-event-id { padding: 0 0 14px; border-right: 0; border-bottom: 1px solid var(--pd-line); }
  .pd-event-main { padding: 0; }
  .pd-event-actions { justify-content: flex-start; }
  .pd-act { flex: 1; }
}

@media (max-width: 760px) {
  .pd-feed-head { padding-top: 26px; }
  .pd-feed-intro h1 { font-size: 32px; }
  .pd-feed-intro p { font-size: 15.5px; }
  .pd-feed-stats { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 2px 16px 6px; }
  .pd-stat { flex: 0 0 176px; scroll-snap-align: start; }
  .pd-select { flex: 1 1 calc(50% - 5px); }
  .pd-toolbar-clear { flex: 1 1 100%; }
  .pd-event-desc, .pd-inline-diff, .pd-event-details { margin-left: 0; }
  .pd-event-title { flex-wrap: wrap; }
  .pd-event-details li { white-space: normal; overflow-wrap: anywhere; }
}
