/* ================================================================
   INESC — POSTS  (single post + news listing)
   Scope: .inesc-post-single, .inesc-post-related,
          .inesc-news-listing, .inesc-news-card, .inesc-latest-news.
   Every selector uses plugin-prefixed classes, so nothing restyles the theme.
   ================================================================ */


/* Plugin tokens (--ip-*), the filter bar, the pagination, the listing
   box-model and the people cards come from this plugin's shared set,
   assets/shared/ (`inesc-content-*` handles), shared with the events module.
   This file keeps only the posts-specific layout. The brand variables used
   below (--green, --blue, --dark-blue, --gray, --font-main, --text-*,
   --normal / --semi-bold / --bold, --text-light) come from the theme. */

/* ================================================================
   1. ACCESSIBILITY  (focus ring + reduced motion, all posts components)
   ================================================================ */

/* Accessibility helpers (scoped, won't affect rest of theme) */
.inesc-post-single a:focus-visible,
.inesc-post-single button:focus-visible,
.inesc-post-related a:focus-visible,
.inesc-post-related button:focus-visible,
.inesc-news-listing a:focus-visible,
.inesc-news-listing button:focus-visible,
.inesc-news-card a:focus-visible,
.inesc-news-card button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .inesc-post-single *,
  .inesc-post-related *,
  .inesc-news-listing *,
  .inesc-news-card * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ================================================================
   2. ARTICLE WRAPPER  (single post)
   ================================================================ */

.inesc-post-single {
  font-family: var(--font-main);
  color: var(--blue);
  background: transparent;
  margin: 0 !important;
  padding: 0 !important;
  max-width: 100% !important;
}

.inesc-post-single__container {
  max-width: var(--ip-container);
  margin: 0 auto;
  padding: 2.5rem var(--ip-gutter) 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 2.5rem;
  align-items: start;
}

.inesc-post-single__main {
  min-width: 0; /* allow content to shrink inside the grid track */
}

.inesc-post-single__sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin: 0;
  align-self: start;     /* keep the sidebar at the top of its grid cell */
  position: static !important;  /* stay in place, do not follow scroll (beats theme/custom-CSS sticky) */
  top: auto !important;         /* neutralise any leftover sticky offset */
  z-index: 1;
  width: clamp(13rem, 18vw, 18rem);
}


/* ================================================================
   3. FEATURED IMAGE
   ================================================================ */

.inesc-post-single__media {
  display: block;
  width: 100%;
  margin: 0 0 1.5rem;
  background: var(--ip-placeholder-bg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: 38rem;
}

.inesc-post-single__media .inesc-post-single__img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

.inesc-post-single__img--placeholder {
  width: 100%;
  height: 100%;
  background: var(--ip-placeholder-bg);
}


/* ================================================================
   4. META ROW  (date · tag pills · main label)
   ================================================================ */

.inesc-post-single__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 0 0 1.25rem;
}

.inesc-post-single__date {
  font-size: var(--text-19-5);
  font-style: italic;
  color: var(--gray);
  line-height: 1.2;
  font-weight: var(--normal);
}

.inesc-post-single__tags {
  list-style: none !important;
  margin: 0 0 0 auto !important;  /* push tags + main-label group right of date */
  padding: 0 !important;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.inesc-post-single__tags li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.inesc-post-single__tag {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  background: var(--green);
  color: var(--ip-text-light) !important;
  font-size: var(--text-11);
  font-weight: var(--semi-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none !important;
  line-height: 1;
}

.inesc-post-single__main-label {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  background: var(--dark-blue);
  color: var(--text-light) !important;
  font-size: var(--text-11);
  font-weight: var(--bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none !important;
  line-height: 1;
}

/* The main label links to the filtered news listing
   (e.g. /news-and-events/news/?news_cat=<slug>); tags link to their tag
   archive. Hover/focus = the "ATIVO"
   (active) state from the brand manual (p.10 "BOTÕES" = buttons): filled
   buttons swap green <-> blue.
   Tags go green→blue, the main label goes blue→green. */
a.inesc-post-single__tag,
a.inesc-post-single__main-label {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

a.inesc-post-single__tag:hover,
a.inesc-post-single__tag:focus-visible {
  background: var(--blue);
}

a.inesc-post-single__main-label:hover,
a.inesc-post-single__main-label:focus-visible {
  background: var(--green);
}

/* Keep the button text white in every link state. Needs element+class+pseudo
   specificity (0,2,1) to beat theme rules like `a:link { color: green }`,
   which otherwise tint the label green instead of white. */
a.inesc-post-single__tag:link,
a.inesc-post-single__tag:visited,
a.inesc-post-single__tag:hover,
a.inesc-post-single__tag:focus,
a.inesc-post-single__tag:active,
a.inesc-post-single__main-label:link,
a.inesc-post-single__main-label:visited,
a.inesc-post-single__main-label:hover,
a.inesc-post-single__main-label:focus,
a.inesc-post-single__main-label:active {
  color: var(--text-light) !important;
}

/* Up to two blue category labels, side by side. */
.inesc-post-single__main-labels {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* When there are no tag pills, push the main labels by themselves to the right. */
.inesc-post-single__meta > .inesc-post-single__date + .inesc-post-single__main-labels {
  margin-left: auto;
}

/* Mobile (mockup MOBILEgeral p.11): the date row keeps only the date (left)
   and the blue category labels (right); the tag pills drop below that row as
   a 2-column grid. The markup keeps tags inside __meta (so desktop renders
   them inline, per DESKTOPgeral p.11), so we reflow without touching the DOM:
   flatten __meta with display:contents and order the flex children of __main. */
@media (max-width: 768px) {
  .inesc-post-single__main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 0.75rem;
  }

  /* Lift date / tags / main-label out of __meta so they become flex items
     of __main and can be ordered independently of the title. */
  .inesc-post-single__meta {
    display: contents;
  }

  .inesc-post-single__title      { order: 1; width: 100%; }
  .inesc-post-single__intro      { order: 2; width: 100%; }
  .inesc-post-single__date       { order: 3; }
  .inesc-post-single__main-labels { order: 4; margin-left: auto; }  /* right edge of the date row */
  .inesc-post-single__tags       { order: 5; width: 100%; }        /* tags drop below the date row */
  .inesc-post-single__media      { order: 6; width: 100%; }
  .inesc-post-single__content    { order: 7; width: 100%; }

  /* Tags as an even 2-column grid, like the mockup. */
  .inesc-post-single__tags {
    margin: 0 0 1.25rem !important;  /* beats the desktop `margin: 0 0 0 auto` */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .inesc-post-single__tag {
    display: block;
    text-align: center;
    padding: 0.6rem 0.9rem;
  }
}


/* ================================================================
   5. TITLE  (green left rule)
   ================================================================ */

.inesc-post-single__title {
  font-size: var(--text-38) !important;
  font-weight: var(--bold) !important;
  color: var(--blue) !important;
  line-height: 1.15 !important;
  margin: 0 0 1.5rem !important;
  padding-left: 1rem;
  border-left: 3px solid var(--green);
}


/* ================================================================
   6. INTRO / EXCERPT
   ================================================================ */

.inesc-post-single__intro {
  margin: 0 0 1.5rem;
}

.inesc-post-single__intro p {
  font-size: var(--text-26) !important;
  font-weight: var(--semi-bold) !important;
  color: var(--blue);
  line-height: 1.4;
  margin: 0;
}


/* ================================================================
   7. POST CONTENT  (the_content output, scoped under __content)
   ================================================================ */

.inesc-post-single__content {
  font-size: var(--text-18);
  line-height: 1.7;
  color: var(--blue);
  margin: 0 0 2rem;
}

.inesc-post-single__content > p,
.inesc-post-single__content > ul,
.inesc-post-single__content > ol {
  margin: 0 0 1rem;
}

.inesc-post-single__content h2,
.inesc-post-single__content h3,
.inesc-post-single__content h4 {
  font-family: var(--font-main);
  font-weight: var(--semi-bold);
  color: var(--blue);
  line-height: 1.3;
  margin: 2rem 0 0.8rem;
}

.inesc-post-single__content h2 { font-size: var(--text-26); }
.inesc-post-single__content h3 { font-size: var(--text-22); }
.inesc-post-single__content h4 { font-size: var(--text-19-5); }

/* Body links on hover/focus/active: brand blue, bold, underlined.
   `!important` beats theme rules like `a:link { color: green }` that would
   otherwise win on specificity. NOTE: there is no base-state rule, so
   resting body links take the theme's link styles. Add one here if that is
   not intended. */


.inesc-post-single__content a:hover,
.inesc-post-single__content a:focus,
.inesc-post-single__content a:active {
  color: #005F80 !important;
  font-weight: var(--bold) !important;
  text-decoration: underline !important;
}

.inesc-post-single__content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
}

.inesc-post-single__content blockquote {
  margin: 1.5rem 0;
  padding: 0.5rem 1rem;
  border-left: 3px solid var(--green);
  font-style: italic;
  color: var(--dark-blue);
}


/* ================================================================
   8. SIDEBAR — PEOPLE CARDS  (optional, repeatable)
   ================================================================ */

.inesc-post-single__people {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  min-width: 12rem;
  max-width: 18rem;
  align-self: stretch;
}

/* The .inesc-person card itself lives in assets/shared/people.css. */


/* ================================================================
   9. SHARE SIDEBAR  (right column desktop, below content on mobile)
   ================================================================ */

.inesc-post-single__share {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  background: var(--green);
  color: var(--ip-text-light) !important;
  font-size: var(--text-16);
  font-weight: var(--semi-bold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none !important;
  line-height: 1;
  /* It is a real <button> (copies the link): strip native chrome. */
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

.inesc-post-single__share:hover,
.inesc-post-single__share:focus {
  background: #84b62f;
  color: var(--ip-text-light) !important;
}

.inesc-post-single__share-icon {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.inesc-post-single__share-icon .fa-share-nodes,
.inesc-post-single__share-icon .fa-solid {
  font-size: 1.05em;
  line-height: 1;
}

.inesc-post-single__socials {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.inesc-post-single__socials li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.inesc-post-single__social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  background: var(--dark-blue);
  color: var(--ip-text-light) !important;
  font-size: 1.1rem;
  text-decoration: none !important;
  line-height: 1;
  transition: background-color 0.2s ease;
}

.inesc-post-single__social .fa-brands,
.inesc-post-single__social .fa-solid {
  color: var(--ip-text-light);
  font-size: 1em;
  line-height: 1;
}

.inesc-post-single__social:hover,
.inesc-post-single__social:focus {
  background: var(--blue);
}


/* ================================================================
   10. RELATED ARTICLES BLOCK
   ================================================================ */

.inesc-post-related {
  max-width: var(--ip-container);
  margin: 1rem auto 0;
  padding: 2rem var(--ip-gutter) 4rem;
  border-top: 2px solid var(--green);
}

.inesc-post-related__heading {
  font-family: var(--font-main);
  font-size: var(--text-36) !important;
  font-weight: var(--semi-bold) !important;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0;
  margin: 0 0 2rem !important;
}

/* Heading + carousel arrows on one row. */
.inesc-post-related__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 2rem;
}

.inesc-post-related__head .inesc-post-related__heading {
  margin: 0 !important;
}

/* Carousel arrows (shared look across related posts + upcoming events). */
.inesc-carousel-nav {
  display: flex;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.inesc-carousel-nav[hidden] {
  display: none;
}

.inesc-carousel-nav__btn {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 2px solid var(--green);
  border-radius: 50%;
  background: transparent;
  color: var(--green);
  /* The arrow is drawn as a mask (::before) so it's perfectly centred; the
     ‹ › text entity is hidden. */
  font-size: 0;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

/* Chevron drawn via SVG mask, sized to the circle and centred. Inherits the
   button colour (green → white on hover) through currentColor. */
.inesc-carousel-nav__btn::before {
  content: "";
  width: 45%;
  height: 45%;
  background-color: currentColor;
  -webkit-mask: center / contain no-repeat;
          mask: center / contain no-repeat;
}

.inesc-carousel-nav__btn[data-carousel-prev]::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5 L8 12 L15 19'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5 L8 12 L15 19'/%3E%3C/svg%3E");
}

.inesc-carousel-nav__btn[data-carousel-next]::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5 L16 12 L9 19'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5 L16 12 L9 19'/%3E%3C/svg%3E");
}

.inesc-carousel-nav__btn:hover:not(:disabled),
.inesc-carousel-nav__btn:focus-visible:not(:disabled) {
  background: var(--green);
  color: #fff;
}

.inesc-carousel-nav__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Carousel dots (below the track) — matches the theme's .carousel-dot look:
   a filled green dot, the active one a hollow green ring. */
.inesc-carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-top: 24px;
}

.inesc-carousel-dots[hidden] {
  display: none;
}

.inesc-carousel-dots__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: var(--green);
  padding: 0;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.inesc-carousel-dots__dot.is-active {
  width: 10px;
  height: 10px;
  background: transparent;
  border: none;
  box-shadow: 0 0 0 3px var(--green);
}

/* Carousel track: 3 cards per view, but a horizontal scroll-snap row so it
   can hold every related card (up to RELATED_COUNT = 9, posts/frontend.php),
   paged by the arrows in assets/carousel.js. Scrollbar hidden. */
.inesc-post-related__grid {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  gap: 2rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.inesc-post-related__grid::-webkit-scrollbar {
  display: none;
}

.inesc-post-related__card {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Three cards per view (2 gaps of 2rem). */
  flex: 0 0 calc((100% - 2 * 2rem) / 3);
  scroll-snap-align: start;
}

.inesc-post-related__media {
  display: block;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  aspect-ratio: 16 / 10;
  background: var(--ip-placeholder-bg);
  border: 2px solid var(--green);
  overflow: hidden;
  margin-bottom: 1rem;
}

.inesc-post-related__img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  position: absolute;
  inset: 0;
  display: block;
  transition: transform 0.4s ease;
}

.inesc-post-related__card:hover .inesc-post-related__img,
.inesc-post-related__card:focus-within .inesc-post-related__img {
  transform: scale(1.05);
}

.inesc-post-related__img--placeholder {
  background: var(--ip-placeholder-bg);
}

.inesc-post-related__body {
  border-left: 2px solid var(--green);
  padding-left: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1 1 auto;
}

.inesc-post-related__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.inesc-post-related__date {
  font-family: var(--font-main);
  font-size: var(--text-19-5);
  font-style: italic;
  color: var(--blue);
  line-height: 1.2;
}

.inesc-post-related__tag {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  /* This pill is the primary CATEGORY → blue (tags are the green ones),
     matching the single-post main-label. */
  background: var(--dark-blue);
  color: var(--ip-text-light) !important;
  font-family: var(--font-main);
  font-size: var(--text-11);
  font-weight: var(--bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none !important;
  line-height: 1;
}

/* Related card category = link to /news-and-events/news/?news_cat=<slug>.
   White text in every link state (beats theme `a` colors); hover swaps the
   blue category pill to green per the brand manual (p.10 BOTÕES, "ATIVO"). */
a.inesc-post-related__tag {
  cursor: pointer;
  transition: background-color 0.15s ease;
}
a.inesc-post-related__tag:link,
a.inesc-post-related__tag:visited,
a.inesc-post-related__tag:hover,
a.inesc-post-related__tag:focus,
a.inesc-post-related__tag:active {
  color: var(--ip-text-light) !important;
}
a.inesc-post-related__tag:hover,
a.inesc-post-related__tag:focus-visible {
  background: var(--green);
}

.inesc-post-related__title {
  margin: 0 !important;
  font-family: var(--font-main);
  font-size: var(--text-22) !important;
  font-weight: var(--bold) !important;
  line-height: 1.3 !important;
  color: var(--blue) !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  /* Title stays complete: JS (balanceCard) measures its real height and gives
     the excerpt whatever remains of the 6-line budget. The 6-line clamp here
     is only the no-JS fallback (and lets JS measure up to the full budget). */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  line-clamp: 6;
  overflow: hidden;
}

.inesc-post-related__title a {
  color: var(--blue) !important;
  text-decoration: none !important;
}

.inesc-post-related__title a:hover,
.inesc-post-related__title a:focus {
  color: var(--green) !important;
}

.inesc-post-related__excerpt {
  margin: 0 !important;
  font-family: var(--font-main);
  font-size: var(--text-17) !important;
  line-height: 1.55 !important;
  color: var(--blue);
  overflow-wrap: anywhere;
  word-break: break-word;
  /* Excerpt fills the rest of the 6-line budget: JS sets --ip-excerpt-lines
     (6 − title lines). Fallback 4 before JS runs / if JS is off. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--ip-excerpt-lines, 4);
  line-clamp: var(--ip-excerpt-lines, 4);
  overflow: hidden;
}

.inesc-post-related__readmore {
  /* Sit at the bottom of the card column, left-aligned, no border. */
  margin-top: auto;
  padding-top: 0.6rem;
  align-self: flex-start;
  border: 0;
  font-style: italic;
  color: var(--gray);
  text-decoration: none !important;
  transition: color 0.2s ease;
}

.inesc-post-related__readmore:hover,
.inesc-post-related__readmore:focus {
  color: var(--green);
}

/* ================================================================
   11. RELATED — TABLET / MOBILE
   ================================================================ */

@media (max-width: 1024px) {
  .inesc-post-related__card {
    /* Two cards per view on tablet. */
    flex: 0 0 calc((100% - 2rem) / 2);
  }
}

@media (max-width: 768px) {
  .inesc-post-single__container {
    padding: 1.5rem 5vw 1rem;
    grid-template-columns: 1fr;
    row-gap: 1.5rem;
  }

  .inesc-post-single__sidebar {
    position: static;
    width: 100%;
    max-width: 22rem;
    margin: 0 auto;
    gap: 1.5rem;
  }

  .inesc-post-single__people {
    max-width: 100%;
    width: 100%;
  }

  .inesc-post-single__share,
  .inesc-post-single__socials {
    align-self: center;
  }

  .inesc-post-single__title {
    font-size: var(--text-26) !important;
  }

  .inesc-post-single__intro p {
    font-size: var(--text-18) !important;
  }

  .inesc-post-related {
    padding: 1.5rem 5vw 2.5rem;
  }

  .inesc-post-related__heading {
    text-align: center;
    font-size: var(--text-22) !important;
    margin-bottom: 1.2rem !important;
  }

  /* Related: horizontal swipe carousel on phones. One card fills most of
     the viewport with the next peeking on the right; dots track position. */
  .inesc-post-related__grid {
    position: relative;
    display: flex !important;
    flex-wrap: nowrap !important;
    grid-template-columns: none !important;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Let the peeking card bleed to the section edge. */
    margin: 0 calc(var(--ip-gutter) * -1);
    padding: 0 var(--ip-gutter);
  }

  .inesc-post-related__grid::-webkit-scrollbar {
    display: none;
  }

  .inesc-post-related__card {
    flex: 0 0 85% !important;
    width: 85%;
    max-width: 85%;
    scroll-snap-align: start;
  }

}


/* ================================================================
   12. NEWS LISTING — [inesc_news] shortcode
   ================================================================ */

/* Box-model (flush wrapper) comes from assets/shared/listing.css. */
.inesc-news-listing {
  font-family: var(--font-main);
  color: var(--blue);
}

/* Filter tabs (.inesc-filter-tabs) → entirely in assets/shared/filter-tabs.css. */

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

.inesc-news-listing__grid {
  list-style: none !important;
  padding: 0 !important;
  display: grid;
  /* Cards per row: --inesc-news-cols(-tablet/-mobile) are set inline on the
     wrapper by the `columns*` shortcode attributes (news-listing.php
     wrapper_style()); unset = 3 / 2 / 1. */
  grid-template-columns: repeat(var(--inesc-news-cols, 3), minmax(0, 1fr));
  column-gap: 5rem;
  row-gap: 3rem;
}


 /* The [inesc_news] grid gets its outer margin from the shared
    .inesc-listing__block; the [inesc_latest_news] grid only needs a small
    bottom margin above the "see all" button. */
  .inesc-latest-news .inesc-latest-news__grid {
      margin: 0 0 1rem 0 !important;
  }

/* ---- News card (li.inesc-news-card, shared by [inesc_news] and
        [inesc_latest_news]; markup in news-listing.php render_card()) ---- */
.inesc-news-card {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  background: transparent;
}

.inesc-news-card__media {
  display: block;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  /* Responsive 16:10 height (62.5% of the width) + 1rem extra height */
  height: 0;
  padding-bottom: calc(62.5% + 1rem);
  background: var(--ip-placeholder-bg);
  border: 2px solid var(--ip-news-border, var(--green)) !important;
  overflow: hidden;
  margin: 0 0 1rem;
}

.inesc-news-card__img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
  position: absolute;
  inset: 0;
  transition: transform 0.4s ease;
}

/* Slight zoom on the card image when the card is hovered/focused. The
   .__media wrapper has overflow:hidden so the scale stays inside the frame. */
.inesc-news-card:hover .inesc-news-card__img,
.inesc-news-card:focus-within .inesc-news-card__img {
  transform: scale(1.05);
}

.inesc-news-card__img--placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--ip-placeholder-bg);
}

.inesc-news-card__body {
  position: relative;
  /* Kill any border the theme paints on the card body — the accent line is
     drawn by the ::before pseudo-element below, not a real border. */
  border: 0 none !important;
  padding-left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1 1 auto;
}

/* Green (or picked) accent line. Drawn as a pseudo-element — not a border —
   so it can stop above the "read more" link: carousel.js sets
   --ip-readmore-gap to the distance from the body's bottom to the read-more's
   top. Without JS it falls back to spanning the full height (bottom: 0). */
.inesc-news-card__body::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: var(--ip-readmore-gap, 0);
  width: 2px;
  background: var(--ip-news-border, var(--green));
}

.inesc-news-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  min-height: 1.5rem;
}

.inesc-news-card__date {
  font-family: var(--font-main);
  font-size: var(--text-19-5);
  font-style: italic;
  color: var(--gray) !important;
  line-height: 1.2;
}

.inesc-news-card__label {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  background: var(--dark-blue);
  color: var(--ip-text-light) !important;
  font-family: var(--font-main);
  font-size: var(--text-11);
  font-weight: var(--bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none !important;
  line-height: 1;
}

/* Listing/latest card category = link to /news-and-events/news/?news_cat=<slug>.
   White text in every link state (beats theme `a` colors); hover swaps the
   blue pill to green per the brand manual (p.10 BOTÕES, "ATIVO"). */
a.inesc-news-card__label {
  cursor: pointer;
  transition: background-color 0.15s ease;
}
a.inesc-news-card__label:link,
a.inesc-news-card__label:visited,
a.inesc-news-card__label:hover,
a.inesc-news-card__label:focus,
a.inesc-news-card__label:active {
  color: var(--ip-text-light) !important;
}
a.inesc-news-card__label:hover,
a.inesc-news-card__label:focus-visible {
  background: var(--green);
}

.inesc-news-card__title {
  margin: 0 !important;
  font-family: var(--font-main);
  font-size: var(--text-22) !important;
  font-weight: var(--bold) !important;
  color: var(--blue) !important;
  line-height: 1.25 !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inesc-news-card__title a {
  color: var(--blue) !important;
  text-decoration: none !important;
  transition: color 0.2s ease;
}

.inesc-news-card__title a:hover,
.inesc-news-card__title a:focus {
  color: var(--green) !important;
}

.inesc-news-card__excerpt {
  margin: 0 !important;
  font-family: var(--font-main);
  font-size: var(--text-17) !important;
  font-weight: var(--normal) !important;
  color: var(--blue);
  line-height: 1.55 !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  /* Line-clamp: JS sets --ip-excerpt-lines (total budget minus title lines).
     The per-container fallbacks below apply before JS runs / if JS is off. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--ip-excerpt-lines, 3);
  line-clamp: var(--ip-excerpt-lines, 3);
  overflow: hidden;
}

/* No-JS fallbacks (carousel.js overrides them inline once it runs, with a
   5-line title + excerpt budget): excerpt 3 lines for "last news" and 4 for
   the [inesc_news] listing; title clamped to 4 lines in "last news" and 5 in
   the listing (rule further below). */
.inesc-latest-news .inesc-news-card__excerpt {
  -webkit-line-clamp: var(--ip-excerpt-lines, 3);
  line-clamp: var(--ip-excerpt-lines, 3);
}

.inesc-news-listing .inesc-news-card__excerpt {
  -webkit-line-clamp: var(--ip-excerpt-lines, 4);
  line-clamp: var(--ip-excerpt-lines, 4);
}

.inesc-news-card__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.inesc-latest-news .inesc-news-card__title {
  -webkit-line-clamp: 4;
  line-clamp: 4;
}

/* "last news" read more: no border, left-aligned. Scoped selector to beat
   the theme's bordered-button anchor styles inside this block. */
.inesc-latest-news .inesc-news-card__readmore {
  border: 0 !important;
  background: none !important;
  padding-left: 0 !important;
  text-align: left;
  align-self: flex-start;
}

.inesc-news-listing .inesc-news-card__title {
  -webkit-line-clamp: 5;
  line-clamp: 5;
}

a.inesc-news-card__readmore,
.inesc-news-card a.inesc-news-card__readmore {
  /* Anchor "read more" links at the bottom of each card body so they
     align across cards in a row, regardless of title/excerpt height.
     Works because:
       - the grid stretches all cards to the tallest one
       - .__body is flex column with flex: 1 1 auto
       - margin-top: auto absorbs leftover vertical space            */
  margin-top: auto;
  padding: 0.6rem 0 0 !important;
  font-family: var(--font-main);
  font-size: var(--text-19-5);
  font-style: italic;
  color: var(--gray) !important;
  text-decoration: none !important;
  /* Left-aligned, NO border whatsoever — the theme styles card anchors as
     bordered buttons (green left border). Kill every side explicitly plus
     border-image / box-shadow in case the bar is drawn that way. */
  border: 0 none !important;
  border-left: 0 none !important;
  border-image: none !important;
  box-shadow: none !important;
  background: none !important;
  text-align: left;
  align-self: flex-start;
  transition: color 0.2s ease;
}

a.inesc-news-card__readmore:hover,
a.inesc-news-card__readmore:focus {
  color: var(--green) !important;
}

/* ---- [inesc_latest_news] "see all" button ----
   Outlined green CTA: green border + text + chevron; on hover/focus solid
   green with white text and a small lift. Restyle it from Posts → Single-post
   CSS through the custom properties, e.g.
     .inesc-latest-news { --inesc-see-all-color: #0f3e5c; }
   !important beats the theme's bordered-button / a:hover anchor styles. */
.inesc-latest-news__footer {
  text-align: var(--inesc-see-all-align, center);
}

.inesc-latest-news a.inesc-latest-news__see-all {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  box-sizing: border-box;
  padding: var(--inesc-see-all-padding, 6px 14px) !important;
  border: 1px solid var(--inesc-see-all-color, #8ac24a) !important;
  border-radius: var(--inesc-see-all-radius, 4px) !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--inesc-see-all-color, #8ac24a) !important;
  font-family: var(--font-main);
  font-size: var(--inesc-see-all-font-size, 19px);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none !important;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.inesc-latest-news a.inesc-latest-news__see-all:hover,
.inesc-latest-news a.inesc-latest-news__see-all:focus-visible {
  background: var(--inesc-see-all-color, #8ac24a) !important;
  color: var(--inesc-see-all-color-hover, #ffffff) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12) !important;
}

.inesc-latest-news a.inesc-latest-news__see-all:focus-visible {
  outline: 2px solid var(--blue, #0f3e5c);
  outline-offset: 2px;
}

.inesc-latest-news__see-all-icon {
  width: 0.6em;
  height: 0.95em;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .inesc-latest-news a.inesc-latest-news__see-all { transition: none; }
  .inesc-latest-news a.inesc-latest-news__see-all:hover,
  .inesc-latest-news a.inesc-latest-news__see-all:focus-visible { transform: none; }
}


/* ================================================================
   13. PAGINATION → .inesc-pagination, styled by assets/shared/pagination.css
   ================================================================ */

/* Empty-state message of both news blocks. */
.inesc-news-listing__empty {
  font-family: var(--font-main);
  font-size: var(--text-20);
  color: var(--gray);
  text-align: center;
  margin: 3rem 0;
}


/* ================================================================
   14. NEWS LISTING — TABLET / MOBILE
   ================================================================ */

@media (max-width: 1024px) {
  .inesc-news-listing__grid {
    grid-template-columns: repeat(var(--inesc-news-cols-tablet, 2), minmax(0, 1fr));
    column-gap: 2rem;
    row-gap: 2.5rem;
  }
}

@media (max-width: 768px) {
  .inesc-news-listing__grid {
    grid-template-columns: repeat(var(--inesc-news-cols-mobile, 1), minmax(0, 1fr));
    column-gap: 1.25rem;
    row-gap: 2rem;
  }
}
