/* 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: 12px;
  padding: 18px;
  flex: 1;
}

/* Variante C: the key question is the headline, the academic details sit under it */
.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.paper-headline {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  color: #0f4c81;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}
.paper-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.paper-authors {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  font-style: italic;
  color: #4b5563;
}
.paper-meta .paper-title {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  color: #374151;
}
.paper-outlet {
  margin: 0;
  font-style: normal;
  font-size: 12.5px;
  line-height: 1.4;
  color: #6b7280;
}
.paper-outlet:empty {
  display: none;
}

/* 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;
}

/* Key findings, What it means for you, (on the paper page) Summary and Transcript:
   one shape — a full-width row, closed by default, chevron turning as it opens */
.card-sections {
  display: flex;
  flex-direction: column;
}
.card-section {
  border-top: 1px solid #e5e7eb;
}
.card-section > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  list-style: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #0f4c81;
}
.card-section > summary::-webkit-details-marker {
  display: none;
}
.card-section > summary:hover {
  color: var(--ais-navy);
}
.card-section-chevron {
  flex-shrink: 0;
  transition: transform 0.15s;
}
.card-section[open] .card-section-chevron {
  transform: rotate(90deg);
}
.card-section ul {
  margin: 0 0 12px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
  color: #374151;
}
.card-section li {
  margin: 0 0 6px;
}
.card-section-text {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.55;
  color: #374151;
}
.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: #6b7280;
  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-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5b6470;
  background: #f1f2f4;
  border: 1px solid #d9dce0;
  border-radius: var(--pill);
}

/* The human pill is the stronger claim, so it is the one that carries colour —
   the neutral "AI Processed" beside it stays deliberately quiet. */
.approval-badge--human {
  font-weight: 700;
  color: #1b6e3d;
  background: #e9f6ee;
  border-color: #b6e0c4;
}
.approval-badge--human i {
  font-size: 10px;
}

/* --- 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-headline {
    font-size: 17px;
  }
  .grid-container,
  .featured-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
}


/* ==========================================================================
   Home search hero. Ask used to occupy this slot and was read as a search box;
   now the box in this slot really is one, and Ask has a door beside it.
   ========================================================================== */

.search-hero { max-width: 1400px; margin: 0 auto; padding: 26px 40px 6px; }

.search-hero-form { display: flex; gap: 10px; align-items: stretch; }

.search-hero-field { position: relative; flex: 1 1 auto; }
.search-hero-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--slate); font-size: 15px; pointer-events: none;
}
.search-hero-input {
  width: 100%; padding: 14px 16px 14px 42px;
  font-family: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--pill);
  transition: border-color .15s, box-shadow .15s;
}
.search-hero-input::placeholder { color: var(--slate); }
.search-hero-input:focus {
  outline: none; border-color: var(--ais-blue);
  box-shadow: 0 0 0 3px rgba(29, 53, 87, 0.10);
}
.search-hero-btn {
  padding: 0 26px; font-family: inherit; font-size: 15px; font-weight: 700;
  color: #fff; background: var(--ais-blue); border: none;
  border-radius: var(--pill); cursor: pointer; transition: background .15s;
}
.search-hero-btn:hover { background: #16263f; }

.search-hero-alt { margin: 10px 2px 0; font-size: 14px; color: var(--slate); }
.search-hero-link { color: var(--ais-blue); font-weight: 600; text-decoration: none; }
.search-hero-link:hover { text-decoration: underline; }
.search-hero-link i { font-size: 11px; margin-left: 2px; }

@media (max-width: 720px) {
  .search-hero { padding: 16px 16px 4px; }
  /* Stacked rather than shrunk: a 16px font stops iOS zooming the page on focus. */
  .search-hero-form { flex-direction: column; }
  .search-hero-btn { padding: 13px 26px; }
}
