/* Pinterest-style list cards + collection previews */
.rail.pin-rail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 1.1rem;
  /* Allow overflow menus to paint outside card bounds */
  overflow: visible;
}
.pin-card {
  position: relative;
  background: #fff;
  border: 1px solid rgba(29, 39, 77, 0.1);
  border-radius: 12px;
  /* Do NOT clip — ⋯ menu must escape the card */
  overflow: visible;
  display: flex;
  flex-direction: column;
  z-index: 0;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.pin-card:hover {
  border-color: rgba(29, 39, 77, 0.18);
  box-shadow: 0 6px 18px rgba(29, 39, 77, 0.08);
}
.pin-card:focus-within,
.pin-card:has(.pin-menu.is-open),
.pin-card.has-canvas-pop {
  z-index: 6;
}
.pin-canvas-pop {
  position: absolute;
  left: 50%;
  top: 0.35rem;
  z-index: 15;
  width: min(28rem, 92vw);
  max-width: 28rem;
  padding: 0.35rem;
  background: #fff;
  border: 1px solid rgba(29, 39, 77, 0.18);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(29, 39, 77, 0.22);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(6px) scale(0.96);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    visibility 0s linear 180ms;
}
.pin-canvas-pop.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    visibility 0s linear 0s;
}
.pin-canvas-pop img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  background: #eef1f5;
}
@media (hover: none), (pointer: coarse) {
  .pin-canvas-pop {
    opacity: 0 !important;
    visibility: hidden !important;
  }
}
.pin-thumb {
  aspect-ratio: 1 / 1;
  background: linear-gradient(145deg, #e6eaef, #f3f5f7);
  overflow: hidden;
  border-radius: 12px 12px 0 0;
}
.pin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pin-thumb.missing {
  min-height: 10rem;
}
.pin-meta {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 0.25rem 0.35rem;
  padding: 0.55rem 0.65rem 0.65rem;
  position: relative;
}
.pin-title {
  font-family: Quicksand, system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.pin-more {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  color: var(--brand-space-cadet, #1d274d);
  border-radius: 6px;
}
.pin-more:hover,
.pin-more[aria-expanded='true'] {
  background: rgba(29, 39, 77, 0.06);
}
.pin-heart {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--brand-space-cadet, #1d274d);
  padding: 0.1rem 0.2rem;
  min-width: 1.7rem;
  line-height: 1;
  border-radius: 6px;
  font: inherit;
}
.pin-heart:hover {
  background: rgba(29, 39, 77, 0.06);
}
.pin-heart.is-on {
  color: var(--brand-princeton-orange, #ff832e);
}
.pin-heart .heart-n {
  font-size: 0.65rem;
  font-weight: 700;
}
.pin-views {
  font-size: 0.7rem;
  opacity: 0.65;
  white-space: nowrap;
}
.pin-menu {
  position: absolute;
  right: 0.35rem;
  top: calc(100% - 0.25rem);
  z-index: 20;
  background: #fff;
  border: 1px solid rgba(29, 39, 77, 0.15);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(29, 39, 77, 0.16);
  flex-direction: column;
  min-width: 10.5rem;
  padding: 0.25rem 0;
  /* Closed by default — never rely on [hidden] alone vs display:flex */
  display: none;
}
.pin-menu.is-open {
  display: flex;
}
.pin-menu button,
.pin-menu .pin-menu-link {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font: inherit;
  color: var(--brand-space-cadet, #1d274d);
  text-decoration: none;
  display: block;
  width: 100%;
  box-sizing: border-box;
}
.pin-menu button:hover,
.pin-menu .pin-menu-link:hover {
  background: rgba(255, 131, 46, 0.1);
}
.coll-card {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(29, 39, 77, 0.12);
  border-radius: 16px;
  padding: 0.85rem;
}
.coll-card a { color: inherit; text-decoration: none; }
.coll-name {
  margin: 0 0 0.55rem;
  font-family: Quicksand, system-ui, sans-serif;
  font-size: 1.05rem;
}
.coll-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1;
  background: #e8ecf1;
}
.coll-grid span {
  background-size: cover;
  background-position: center;
  background-color: #d5dae2;
}
.coll-grid span.empty { background: #cfd5df; }
.coll-sig {
  margin: 0.55rem 0 0;
  font-size: 0.85rem;
  color: var(--brand-dark-gray, #a8a8a8);
}
.coll-sig a { color: var(--brand-metallic-blue, #2a5b84); font-weight: 600; }
.section-more {
  margin-top: 0.75rem;
  display: inline-block;
  font-weight: 700;
  color: var(--brand-metallic-blue, #2a5b84);
}
.rail.coll-rail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1rem;
}

/* Shared dialogs: report + add to list */
.cd-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(29, 39, 77, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cd-modal {
  background: #fff;
  color: var(--brand-space-cadet, #1d274d);
  border-radius: 12px;
  width: min(28rem, 100%);
  max-height: min(90vh, 40rem);
  overflow: auto;
  box-shadow: 0 18px 48px rgba(29, 39, 77, 0.28);
  padding: 1rem 1.1rem 1.05rem;
}
.cd-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.cd-modal-head h2 {
  margin: 0;
  font-family: Quicksand, system-ui, sans-serif;
  font-size: 1.2rem;
}
.cd-modal-x {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}
.cd-modal-x:hover {
  background: rgba(29, 39, 77, 0.08);
}
.cd-modal-body label,
.cd-modal-body legend {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0.75rem 0 0.35rem;
}
.cd-modal-body input[type='text'],
.cd-modal-body textarea,
.cd-modal-body select {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(29, 39, 77, 0.2);
  border-radius: 8px;
  color: inherit;
  background: #fff;
}
.cd-modal-body textarea {
  resize: vertical;
  min-height: 5rem;
}
.cd-modal-body .muted {
  color: #666;
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}
.cd-reason-set {
  border: 1px solid rgba(29, 39, 77, 0.14);
  border-radius: 10px;
  padding: 0.45rem 0.55rem 0.55rem;
  margin: 0.35rem 0 0;
}
.cd-reason {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.25rem;
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}
.cd-reason input {
  width: 1.05rem;
  height: 1.05rem;
}
.cd-check-row {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  margin-top: 0.85rem !important;
  min-height: 2.5rem;
}
.cd-check-row input {
  width: 1.1rem;
  height: 1.1rem;
}
.cd-modal-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.cd-btn {
  font: inherit;
  font-weight: 700;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
}
.cd-btn.primary {
  background: #ff832e;
  color: #fff;
  border-color: #ff832e;
}
.cd-btn.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.cd-btn.ghost {
  background: transparent;
  border-color: rgba(29, 39, 77, 0.22);
  color: inherit;
}
.cd-modal-status {
  margin: 0.65rem 0 0;
  font-size: 0.9rem;
}
.cd-modal-status.err {
  color: #8b1e1e;
}
.cd-pick-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  max-height: 16rem;
  overflow: auto;
  border: 1px solid rgba(29, 39, 77, 0.12);
  border-radius: 10px;
}
.cd-pick-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  border: 0;
  border-bottom: 1px solid rgba(29, 39, 77, 0.08);
  background: #fff;
  padding: 0.7rem 0.8rem;
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.cd-pick-item:last-child {
  border-bottom: 0;
}
.cd-pick-item:hover,
.cd-pick-item:focus-visible {
  background: rgba(255, 131, 46, 0.1);
  outline: none;
}
.cd-pick-name {
  font-weight: 700;
}
.cd-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 1300;
  background: #1d274d;
  color: #e0e1dd;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: 0 8px 24px rgba(29, 39, 77, 0.28);
  transition: opacity 220ms ease, transform 220ms ease;
}
.cd-toast.is-out {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}
@media (max-width: 520px) {
  .cd-modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 12px 12px 0 0;
    align-self: flex-end;
  }
  .cd-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
}
