/* AIS Insights — listing and card styles.
 *
 * Split out of the inline <style> in base_layout.html so the card can be worked on
 * without editing every page's shell. Header, navigation and the info pages still take
 * their styles from base_layout.
 *
 * Colours are the AIS palette from aisnet.org: #30689B links, #0A4770 on hover, #6EC1E4
 * accent, #363636 text, #69727D muted, #dddddd rules, #F2F5F7 surface. --ais-blue stays
 * the established #004f80 so nothing shifts hue; the freshness here is structural —
 * radius, a real border colour, a shadow that lifts on hover, and buttons that look like
 * buttons.
 */

:root {
  --ais-navy: #0a4770;
  --ais-link: #30689b;
  --ais-sky: #6ec1e4;
  --ink: #363636;
  --slate: #69727d;
  --line: #dfe5ec;
  --surface: #f2f5f7;
  --card-radius: 16px;
  --pill: 999px;
}

/* --- listing controls ---------------------------------------------------- */

.search-input {
  width: 100%;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--ais-link);
  box-shadow: 0 0 0 3px rgba(48, 104, 155, 0.16);
}

.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  font-size: 14px;
  color: var(--ais-link);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.topic-chip:hover {
  background: #fff;
  border-color: var(--ais-link);
  color: var(--ais-navy);
}
.topic-chip.active {
  background: var(--ais-blue);
  border-color: var(--ais-blue);
  color: #fff;
}

.load-more-btn {
  padding: 11px 28px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ais-blue);
  background: #fff;
  border: 1px solid var(--ais-blue);
  border-radius: var(--pill);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.load-more-btn:hover {
  background: var(--ais-blue);
  color: #fff;
}
.page-info {
  display: block;
  margin-top: 10px;
  font-size: 14px;
  color: var(--slate);
}

/* --- card ---------------------------------------------------------------- */

.paper-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(10, 71, 112, 0.05);
  transition: transform 0.15s, box-shadow 0.15s;
}
.paper-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(10, 71, 112, 0.12);
}

/* the old rule pulled the image out of the card with negative margins; the card owns no
   padding now, so the thumbnail is simply the first row */
.card-image-container {
  position: relative;
  width: 100%;
  margin: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, var(--ais-navy), var(--ais-link));
  border-bottom: 1px solid var(--line);
}
.card-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 18px;
  flex: 1;
}

.paper-outlet {
  margin: 0;
  font-size: 11.5px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
  color: var(--ais-link);
}

.paper-title {
  margin: 0;
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.34;
  color: var(--ais-navy);
}
.paper-subtitle {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--slate);
}

.paper-authors {
  margin: 0;
  font-size: 13.5px;
  font-style: italic;
  color: var(--slate);
}

/* the player used to sit in a grey block with an inverted colour filter over it */
.player-row {
  margin: 2px 0;
  padding: 0;
  background: none;
}
.paper-card audio {
  width: 100%;
  height: 38px;
  filter: none;
}

.summary-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
}
.summary-text {
  font-size: 14px;
  line-height: 1.55;
  color: #3a4654;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.summary-text.expanded {
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}
.summary-headings {
  display: block;
  margin-top: 8px;
  font-weight: 700;
  color: var(--ink);
}

.read-more-btn {
  align-self: flex-start;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ais-link);
  background: none;
  border: none;
  cursor: pointer;
}
.read-more-btn:hover {
  color: var(--ais-navy);
  text-decoration: underline;
}

/* recommendations and the transcript are the same shape: a disclosure, closed by default */
.card-details {
  font-size: 13.5px;
}
.card-details > summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  color: var(--slate);
}
.card-details > summary::-webkit-details-marker {
  display: none;
}
.card-details > summary::before {
  content: "\203A  ";
  font-weight: 700;
  color: var(--ais-link);
}
.card-details[open] > summary::before {
  content: "\2304  ";
}
.card-details > summary:hover {
  color: var(--ais-navy);
}
.card-details ul {
  margin: 8px 0 0;
  padding-left: 18px;
}
.card-details li {
  margin-bottom: 6px;
  line-height: 1.45;
}
.transcript-content {
  margin-top: 10px;
  padding: 12px;
  max-height: 320px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  color: #444;
  background: var(--surface);
  border-radius: 10px;
  white-space: pre-wrap;
}

/* --- card footer --------------------------------------------------------- */

.pdf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.keywords {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-style: italic;
  color: var(--slate);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
/* square outlined icon buttons, rather than bare glyphs of three different sizes */
.icon-btn,
.pdf-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 14px;
  color: var(--slate);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover,
.pdf-icon:hover {
  border-color: var(--ais-link);
  color: var(--ais-link);
}

/* --- badges -------------------------------------------------------------- */

.new-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  padding: 4px 9px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  background: #1f9d55;
  border-radius: var(--pill);
}
.approval-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--pill);
  vertical-align: middle;
}

/* --- grid ---------------------------------------------------------------- */

.grid-container,
.featured-grid {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}
.featured-grid .paper-card {
  border-color: var(--ais-sky);
  box-shadow: 0 1px 2px rgba(10, 71, 112, 0.05);
}

@media (max-width: 768px) {
  .paper-card {
    min-height: auto;
  }
  .card-body {
    padding: 15px;
    gap: 8px;
  }
  .paper-title {
    font-size: 16px;
  }
  .paper-authors,
  .summary-text {
    font-size: 13px;
  }
  .grid-container,
  .featured-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
}
