/* Portfolio summaries: isolated from Salient's button and heading styles. */
body.single-portfolio .row.project-title .section-title button.eh-tldr-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 0;
  padding: 9px 15px;
  border: 1px solid rgba(46, 49, 146, 0.18);
  border-radius: 999px !important;
  background: #fff;
  color: #2e3192;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: none;
  cursor: pointer;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

body.single-portfolio .row.project-title .section-title button.eh-tldr-trigger:hover {
  background: #f1f8fe;
  color: #2e3192;
}

body.single-portfolio .row.project-title .section-title button.eh-tldr-trigger:focus-visible {
  outline: 3px solid #27aae1;
  outline-offset: 4px;
}

body.single-portfolio .row.project-title .section-title button.eh-tldr-trigger img {
  display: block;
  flex: 0 0 24px;
  width: 24px !important;
  min-width: 24px;
  max-width: 24px !important;
  height: 24px !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: contain;
}

body.single-portfolio .row.project-title .section-title button.eh-tldr-trigger span {
  position: static;
  display: inline;
  margin: 0;
  padding: 0;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

body dialog#eh-project-tldr {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 80px max(24px, env(safe-area-inset-right)) 48px max(24px, env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  overflow: auto;
  overscroll-behavior: contain;
}

body dialog#eh-project-tldr:not([open]) {
  display: none;
}

body dialog#eh-project-tldr[open] {
  display: flex;
  animation: eh-tldr-fade-in 160ms ease-out both;
}

body dialog#eh-project-tldr::backdrop {
  /* Extend only the decorative layer; controls keep using the visible viewport. */
  min-height: 100vh;
  min-height: 100lvh;
  background: linear-gradient(to bottom right, rgba(39, 170, 225, 0.85), rgba(46, 49, 146, 0.85));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

body dialog#eh-project-tldr[open]::backdrop {
  animation: eh-tldr-fade-in 160ms ease-out both;
}

@keyframes eh-tldr-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* A small upward entrance for the title, followed closely by the summary. */
body dialog#eh-project-tldr[open] #eh-tldr-title,
body dialog#eh-project-tldr[open] .eh-tldr-summary {
  animation: eh-tldr-content-in 400ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

body dialog#eh-project-tldr[open] .eh-tldr-summary {
  animation-delay: 40ms;
}

@keyframes eh-tldr-content-in {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  body dialog#eh-project-tldr[open],
  body dialog#eh-project-tldr[open]::backdrop,
  body dialog#eh-project-tldr[open] #eh-tldr-title,
  body dialog#eh-project-tldr[open] .eh-tldr-summary {
    animation: none;
  }
}

#eh-project-tldr .eh-tldr-panel {
  box-sizing: border-box;
  width: min(100%, 760px);
  margin: auto;
  padding: 24px 0;
  color: #fff;
  text-align: left;
}

#eh-project-tldr #eh-tldr-title {
  margin: 0 0 24px;
  padding: 0;
  color: #fff;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-transform: none;
}

#eh-project-tldr .eh-tldr-summary,
#eh-project-tldr .eh-tldr-summary p {
  color: #fff;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: clamp(17px, calc(2vw - 1px), 21px);
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: normal;
  text-transform: none;
}

#eh-project-tldr .eh-tldr-summary p {
  margin: 0 0 1em;
  padding: 0;
}

#eh-project-tldr .eh-tldr-summary p:last-child {
  margin-bottom: 0;
}

#eh-project-tldr button.eh-tldr-close {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 12px;
  border: 0.5px solid #fff !important;
  border-radius: 50% !important;
  -webkit-appearance: none;
  appearance: none;
  outline: none !important;
  background: transparent;
  color: #fff;
  font-size: 32px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent;
}

#eh-project-tldr button.eh-tldr-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

#eh-project-tldr button.eh-tldr-close:focus-visible {
  /* A fill change signals keyboard focus without adding a second circle. */
  outline: none !important;
  background: rgba(255, 255, 255, 0.22);
}

#eh-project-tldr .eh-tldr-close svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

@media (max-width: 600px) {
  body dialog#eh-project-tldr {
    padding-top: 76px;
    padding-bottom: max(32px, env(safe-area-inset-bottom));
  }

  #eh-project-tldr #eh-tldr-title {
    margin-bottom: 20px;
  }
}

/* Keep the project title, summary button, and featured image evenly spaced. */
body.single-portfolio .row.project-title:has(.eh-tldr-trigger) .section-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

body.single-portfolio .row.project-title:has(.eh-tldr-trigger) .section-title h1,
body.single-portfolio .row.project-title:has(.eh-tldr-trigger) .section-title button.eh-tldr-trigger {
  margin-top: 0;
  margin-bottom: 0;
}

body.single-portfolio .row.project-title:has(.eh-tldr-trigger):has(+ .eh-project-hero-section) .title-wrap {
  padding-bottom: 0 !important;
}

body.single-portfolio .row.project-title:has(.eh-tldr-trigger) + .eh-project-hero-section .eh-project-hero-container {
  padding-top: 14px;
}

/* Salient's float-clearing pseudo-element must not become a flex item. */
body.single-portfolio .row.project-title:has(.eh-tldr-trigger) .section-title::after {
  display: none;
}
