.insight-search {
  flex: 0 1 430px;
}

.insight-heading {
  gap: 20px;
  margin-bottom: 24px;
}


.insight-heading > div:first-child > p {
  margin-top: 10px;
}

.insight-result-count {
  flex: none;
  margin: 0;
  font-weight: 800;
}

.insight-heading-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

.insight-heading-actions > p {
  margin: 0;
}

.insight-view-toggle {
  display: inline-flex;
  padding: 3px;
  background: #eef3f8;
}

.insight-view-button {
  display: grid;
  width: 38px;
  height: 36px;
  padding: 0;
  color: #64748b;
  background: transparent;
  border: 0;
  place-items: center;
}

.insight-view-button svg {
  width: 20px;
  height: 20px;
  fill: currentcolor;
}

.insight-view-button:hover,
.insight-view-button:focus {
  color: var(--blue-800);
  background: #fff;
}

.insight-view-button.active {
  color: #fff;
  background: var(--blue-800);
}

.insight-view-button:focus-visible {
  outline: 3px solid rgb(7 61 122 / 20%);
  outline-offset: 2px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.insight-card {
  display: flex;
  flex-direction: column;
  outline: 3px solid transparent;
  transition: outline-color 0.24s ease, box-shadow 0.24s ease;
}

/* hover：橘色外框＋淡橘陰影，不位移。 */
.insight-card:hover {
  outline-color: var(--color-accent);
  box-shadow: var(--shadow-hover);
}

.insight-card-cover {
  background: linear-gradient(135deg, var(--blue-800), #1768ad);
}

.insight-card-cover img {
  transition: transform 0.35s ease;
}

.insight-card:hover .insight-card-cover img {
  transform: scale(1.035);
}

.insight-card-category {
  position: absolute;
  z-index: 2;
  bottom: 12px;
  left: 12px;
  padding: 5px 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  background: var(--orange);
}

.insight-card-body {
  display: flex;
  height: 100%;
  padding: 16px 18px 18px;
  flex-direction: column;
}

.insight-grid:not(.is-list-view) .insight-card-body {
  height: auto;
  flex: 1;
}

.insight-card-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 7px;
  color: #64748b;
  font-size: 13px;
}

.insight-card h2 {
  display: -webkit-box;
  margin: 0 0 8px;
  overflow: hidden;
  color: var(--blue-800);
  font-size: 19px;
  font-weight: 900;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.insight-card-summary {
  display: -webkit-box;
  margin: 0 0 13px;
  overflow: hidden;
  color: #475569;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.insight-card-footer {
  display: flex;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
  margin-top: auto;
}

.insight-card-footer .insight-more {
  align-self: flex-end;
  margin-left: auto;
}

.insight-tags {
  display: flex;
  min-width: 0;
  gap: 6px;
  flex-wrap: wrap;
}

.insight-tag {
  padding: 4px 8px;
  color: var(--blue-800);
  font-size: 12px;
  font-weight: 800;
  font-family: inherit;
  background: #eef3f8;
  border: 0;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.insight-tag:hover,
.insight-tag:focus-visible {
  color: #fff;
  background: var(--blue-800);
}

.insight-tag:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.insight-grid.is-list-view {
  grid-template-columns: 1fr;
}

.insight-grid.is-list-view .insight-card {
  display: grid;
  grid-template-columns: minmax(210px, 39%) minmax(0, 1fr);
  min-height: 185px;
}

.insight-grid.is-list-view .insight-card-cover {
  align-self: stretch;
  min-height: 100%;
  aspect-ratio: auto;
}

.insight-grid.is-list-view .insight-card-cover img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
}

.insight-grid.is-list-view .insight-card-body {
  padding: 20px 24px;
}

.insight-grid.is-list-view .insight-card-summary {
  -webkit-line-clamp: 2;
}

.insight-pagination {
  --site-page-size: 40px;
  --site-pagination-margin-top: 34px;
}

.insight-detail {
  width: 100%;
  padding: clamp(24px, 5vw, 58px);
  background: #fff;
  border: 1px solid var(--line);
  border-top: var(--accent-bar-lg) solid var(--color-brand);
}

.insight-detail-header {
  width: 100%;
  margin: 0 0 30px;
  text-align: center;
}

.insight-detail-meta {
  display: flex;
  width: 100%;
  gap: 10px 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  color: #64748b;
  font-size: 14px;
  flex-wrap: wrap;
}

.insight-detail-title {
  margin: 0 0 16px;
  color: var(--blue-800);
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 900;
  line-height: 1.3;
}

.insight-detail-lead {
  margin: 0;
  color: #475569;
  font-size: 18px;
}

.insight-detail-cover-wrap {
  position: relative;
  overflow: hidden;
  margin: 0 0 34px;
  background: linear-gradient(135deg, var(--blue-800), #1768ad);
}

.insight-detail-body {
  width: 100%;
}

.insight-detail-body h2 {
  margin: 34px 0 14px;
  color: var(--blue-800);
  font-size: 26px;
  font-weight: 900;
}

.insight-detail-body p {
  margin: 0 0 18px;
  color: #334155;
  font-size: 17px;
  line-height: 1.9;
}

.insight-detail-tags {
  display: flex;
  width: 100%;
  gap: 8px;
  padding-top: 24px;
  margin: 34px 0 0;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.insight-detail-actions {
  display: flex;
  width: 100%;
  gap: 12px;
  justify-content: space-between;
  margin: 34px 0 0;
}

.insight-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px auto 0;
}

.insight-pager-link {
  display: block;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--line);
}

.insight-pager-link:last-child {
  text-align: right;
}

.insight-pager-label {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 13px;
}

.insight-pager-title {
  display: block;
  overflow: hidden;
  color: var(--blue-800);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 991px) {
  .insight-search {
    flex-basis: auto;
  }

  .insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .insight-category-nav {
    flex-wrap: nowrap;
    padding-bottom: 5px;
    overflow-x: auto;
  }

  .insight-category-link {
    white-space: nowrap;
  }

  .insight-search,
  .insight-heading,
  .insight-detail-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .insight-grid,
  .insight-pager {
    grid-template-columns: 1fr;
  }

  .insight-result-count {
    align-self: flex-start;
  }

  .insight-heading-actions {
    justify-content: space-between;
  }

  .insight-card-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .insight-grid.is-list-view .insight-card {
    grid-template-columns: 155px minmax(0, 1fr);
    min-height: 150px;
  }

  .insight-grid.is-list-view .insight-card-body {
    padding: 14px;
  }

  .insight-grid.is-list-view .insight-card-summary,
  .insight-grid.is-list-view .insight-tags {
    display: none;
  }

  .insight-detail {
    padding: 24px 20px;
  }

  .insight-detail-header {
    text-align: left;
  }

  .insight-pager-link:last-child {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .insight-card,
  .insight-card-cover img {
    transition: none;
  }
}

/* 任務30（#8）：未上傳封面時改用淺藍底＋單色 Logo（同訓練資源的預設封面） */
.insight-card-cover.is-placeholder {
  background: #e8f0fa;
}

.insight-card-cover.is-placeholder::before {
  display: none;
}

.insight-card-cover.is-placeholder::after {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 120px;
  height: 120px;
  max-height: 70%;
  background: #9fb6d3;
  content: "";
  -webkit-mask: url("../images/logo-2-256.png") center / contain no-repeat;
  mask: url("../images/logo-2-256.png") center / contain no-repeat;
}
