/* ===============================
   INSIGHTS PAGE — PAGE BACKGROUND & BOTTOM TRIANGLE
   Page background contrasts with the color-2 section so the bottom triangle is visible.
   =============================== */

#insights {
  background-color: var(--bg-color-1);
}

/* Bottom triangle — bridges color-2 (#pub-grid) into page background (color-1) */
#insights .pagecontents:after {
  content: " ";
  height: 0;
  width: 0;
  position: absolute;
  pointer-events: none;
  border: solid transparent;
  border-color: var(--bg-color-1);
  border-top-color: var(--bg-color-2);
  border-width: 30px;
  left: 50%;
  margin-left: -30px;
  top: auto;
  z-index: 1;
}

/* ===============================
   INSIGHTS PAGE — PAGE HEADER
   =============================== */

#insights .pageheader {
  background-image: url(../img/insight.jpg);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  padding: 190px 0 35px 0;
}

#insights .pageheader .title {
  color: #fff;
  border: none;
}

.page-container {
  position: relative;
}

/* ===============================
   PUBLICATION GRID & FILTERS
   =============================== */

#pub-grid .mix {
  opacity: 0;
  display: none;
}

#filters,
.filters,
#pub-grid {
  padding: 20px 0 30px 0 !important;
}

#filters h3,
.filters h3,
div#sort {
  margin-top: 30px;
}

#sort span {
  line-height: 30px;
}

.stuck {
  position: fixed !important;
  z-index: 1001;
  top: 0;
  right: 0;
  box-shadow: 0px 2px 4px 0px var(--shadow-card);
}

/* ===============================
   PUBLICATION CARDS
   =============================== */

.pitems .item {
  margin-bottom: 20px;
  width: 100%;
}

.pitems .pubmain {
  background: var(--bg-card);
  padding: 25px 25px 35px 25px;
  min-height: 130px;
  position: relative;
  box-shadow: 0px 3px 3px -3px var(--shadow-card);
  cursor: pointer;
}

.pitems .pubtitle {
  margin: 0;
  padding: 0 0 15px 0;
  font-size: 20px;
  font-weight: 400;
}

.pitems .pubmain div {
  font-size: small;
}

.pitems .pubmain .label {
  margin-right: 10px;
}

.pitems .pubmain .pubassets {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--bg-card-assets);
  text-align: center;
  border-top: 2px solid var(--accent);
}

.pitems .pubmain .pubassets a {
  color: #9b9b9b;
  padding: 5px 15px;
  float: right;
  font-size: 18px;
}

.pitems .pubmain .pubassets a:hover,
.pitems .pubmain .pubassets a:focus,
.pitems .pubmain .pubassets a.pubcollapse {
  color: #fff;
}

.pubcite {
  padding-bottom: 8px;
}

.pitems .pubdetails {
  background: var(--bg-details);
  padding: 15px 25px 25px 25px;
  display: none;
}

.pubdetails ul {
  padding-left: 15px;
}

.pubdetails ul li {
  padding-bottom: 10px;
}

.pubauthor {
  padding-bottom: 5px;
}

/* ===============================
   FILTER DROPDOWN
   =============================== */

.cd-dropdown,
.cd-select {
  position: relative;
  margin: 20px auto;
  display: block;
}

.cd-dropdown > span {
  width: 100%;
  height: 40px;
  line-height: 40px;
  color: #999;
  font-weight: 700;
  font-size: 16px;
  background: var(--bg-details);
  display: block;
  padding: 0 10px 0 30px;
  position: relative;
  cursor: pointer;
  box-shadow: 0 1px 1px var(--shadow-dropdown);
}

.cd-dropdown > span:after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 50px;
  text-align: center;
  font-size: 12px;
  padding: 8px;
  height: 70%;
  line-height: 24px;
}

.cd-dropdown.cd-active > span:after {
  content: "";
}

.cd-dropdown ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  position: absolute;
  top: 0;
  width: 100%;
}

.cd-dropdown ul li {
  position: absolute;
  width: 100%;
}

.cd-dropdown ul li span {
  width: 100%;
  background: var(--bg-card-assets);
  line-height: 40px;
  padding: 0 10px 0 30px;
  display: block;
  color: #bcbcbc;
  cursor: pointer;
  font-weight: 700;
}

.cd-dropdown ul li:nth-last-child(-n + 3) span {
  box-shadow: 0 1px 1px var(--shadow-dropdown);
}

.cd-active.cd-dropdown > span,
.cd-active.cd-dropdown ul li span {
  box-shadow: 0 1px 1px var(--shadow-dropdown);
}

.cd-active.cd-dropdown ul li span {
  transition: all 0.2s linear;
}

.cd-active.cd-dropdown ul li span:hover {
  color: #fff;
}

/* ===============================
   ARTICLE — BASE LAYOUT
   =============================== */

.insights-article {
  line-height: 1.6;
  font-size: 16px;
  counter-reset: h2-counter; /* h2 scroll animation — initialises section counter */
}

.article-content::after {
  content: "";
  display: block;
  clear: both;
}

/* ===============================
   ARTICLE — TYPOGRAPHY
   =============================== */

.insights-article h1 {
  font-size: 28px;
  font-weight: 400;
  margin: 20px 0 10px;
}

/* h2 scroll animation — keyframes: normal → accent at viewport centre → normal */
@keyframes insight-h2-reveal {
  0%,
  25% {
    color: var(--text-heading);
    transform: scale(1);
  }
  50% {
    color: var(--accent);
    transform: scale(1.03);
  }
  75%,
  100% {
    color: var(--text-heading);
    transform: scale(1);
  }
}

/* h2 scroll animation — base styles; transition serves as the mobile/fallback path */
.insights-article h2 {
  font-size: 22px;
  counter-increment: h2-counter; /* h2 scroll animation — increments section counter */
  color: var(--text-heading);
  transform-origin: left center;
  transition:
    color 0.4s ease,
    transform 0.4s ease;
}

/* h2 scroll animation — peak state applied by IntersectionObserver on unsupported browsers */
.insights-article h2.h2-peak {
  color: var(--accent);
  transform: scale(1.03);
}

/* h2 scroll animation — overrides transition with scroll-driven animation where supported */
@supports (animation-timeline: view()) {
  .insights-article h2 {
    transition: none;
    animation: insight-h2-reveal linear both;
    animation-timeline: view();
    animation-range: cover 0% cover 100%;
  }
}

/* h2 scroll animation — prepends auto-incremented counter (01. 02. …) */
.insights-article h2::before {
  content: counter(h2-counter, decimal-leading-zero) ". ";
}

.insights-article p {
  margin: 10px 0;
  padding-left: 40px;
}

.insights-article p.p-left {
  padding-left: 0;
}

.article-callout {
  background: var(--bg-callout);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  padding: 1rem 1.4rem;
  margin: 1.2rem 0 1.5rem 40px;
  overflow: hidden;
}

.article-callout ul {
  margin-top: 0.6rem;
  margin-bottom: 0;
}

.insights-article ul {
  margin: 10px 0;
  padding-left: 40px;
  list-style: none;
}

.insights-article ol {
  margin: 10px 0;
  padding-left: 40px;
  list-style: none;
  counter-reset: ol-counter;
}

.insights-article ul li,
.insights-article ol li {
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

.insights-article ul li + li,
.insights-article ol li + li {
  margin-top: 4px;
}

.insights-article ol li {
  counter-increment: ol-counter;
  position: relative;
  padding-left: 1.8em;
}

.insights-article ol li::before {
  content: counter(ol-counter) ".";
  position: absolute;
  left: 0;
  width: 1.8em;
}

.insights-article ul li {
  position: relative;
  padding-left: 1.2em;
}

.insights-article ul li::before {
  content: "•";
  position: absolute;
  left: 0;
  width: 1.2em;
}

.article-callout ul,
.article-callout ol {
  padding-left: 0;
}

/* ===============================
   ARTICLE — IMAGES: BASE FIGURE
   =============================== */

.insight-image {
  margin: 1.5rem 0;
  max-width: 100%;
}

.insight-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: zoom-in;
  transition: opacity 0.15s ease;
}

.insight-image img:hover {
  opacity: 0.88;
}

.insight-image figcaption {
  font-size: 1.2rem;
  color: #888;
  margin-top: 0.4rem;
  font-style: italic;
}

/* ===============================
   ARTICLE — IMAGES: FLOAT PLACEMENT
   Floated figures sit directly in the article text flow; surrounding text
   wraps around them. clear: right/left prevents side-by-side stacking when
   multiple images of the same float direction appear close together.
   =============================== */

.image-right {
  float: right;
  clear: right;
  width: 460px;
  max-width: 50%;
  margin: 0 0 3rem 2rem;
}

.image-left {
  float: left;
  clear: left;
  width: 360px;
  max-width: 50%;
  margin: 0 2rem 1.2rem 0;
}

.image-full {
  width: 100%;
  margin: 1rem 0;
}

/* Legacy inline image classes */
.img-left {
  float: left;
  width: 350px;
  padding: 23px 30px 20px 0;
}

.img-wide {
  max-width: 100%;
  height: auto;
  padding: 15px 0 10px 0;
}

/* ===============================
   ARTICLE — IMAGES: SECTION LAYOUT
   insight-section wraps an image alongside a related block of text.
   layout-side: image floats right, text wraps around it within the section.
   layout-full: image spans the full content width below the text.
   =============================== */

.insight-section {
  margin: 1.5rem 0 2rem 0;
}

.insight-section.layout-side .insight-image {
  float: right;
  width: 44%;
  margin: 0 0 1.2rem 2rem;
}

.insight-section.layout-full .insight-image {
  margin: 2rem 0 0 0;
}

.insight-section::after {
  content: "";
  display: block;
  clear: both;
}

/* ===============================
   ARTICLE — LIGHTBOX (reserved, inactive)
   =============================== */

/*
#insight-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.88);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    padding: 2rem;
}

#insight-lightbox.is-open {
    display: flex;
}

#insight-lightbox .lb-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
}

#insight-lightbox img {
    display: block;
    max-width: 100%;
    max-height: 82vh;
    width: auto;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    border: none;
    cursor: default;
}

#insight-lightbox .lb-caption {
    margin-top: 0.75rem;
    color: #ccc;
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
}

#insight-lightbox .lb-close {
    position: absolute;
    top: -2rem;
    right: -0.5rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

#insight-lightbox .lb-close:hover {
    opacity: 1;
}
*/

/* ===============================
   MEDIA QUERIES
   =============================== */

/* — Tablet and below (≤ 991px): paragraph indent removed — */
@media (max-width: 991px) {
  .insights-article p {
    padding-left: 0;
  }

  .insights-article ul {
    padding-left: 0;
  }

  .insights-article ol {
    padding-left: 0;
  }

  .article-callout {
    margin-left: 0;
  }
}

/* — Tablet and below (≤ 860px) — */
@media (max-width: 860px) {
  .insight-section.layout-side .insight-image {
    float: none;
    width: 100%;
    margin: 1rem 0 0 0;
  }

  .image-left,
  .image-right {
    float: none;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0;
  }
}
