/* Shared card finish, loaded after the theme and portfolio styles. */
:root {
  --madep-accent-surface: #ddeff7;
  --madep-card-line: #cfdde4;
  --madep-card-radius: 28px;
  --madep-media-radius: 20px;
  --madep-card-shadow: 0 2px 6px rgba(20, 33, 61, .16);
  --madep-card-shadow-active: 0 8px 18px rgba(20, 33, 61, .20);
}

body :is(
  .project-card, .search-result-card, .key-projects__card, .editorial-card,
  .home-news__item, .home-digest__feature, .home-digest__update, .home-digest__card > a,
  .project-information, .editorial-single__panel, .project-whats-new,
  .project-overview .project-statistics--home, .project-frequency-chart, .project-taxonomy-chart,
  .profile-vision-mission__grid article, .profile-glance__grid > div, .profile-who__facts article,
  .profile-leader, .profile-who__visual, .profile-why__grid article, .profile-value,
  .profile-process__grid article, .profile-assurance__grid article,
  .profile-publication-carousel__card, .profile-publications li,
  .profile-relationships__grid article, .catalogue-card, .profile-links a,
  .capability-overview__grid a, .catalogue-group-links a
) {
  border: 1px solid var(--madep-card-line);
  border-radius: var(--madep-card-radius);
  box-shadow: var(--madep-card-shadow);
  transform: none;
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}

/* Retain the outer dimensions and existing image/text layouts. */
body :is(.project-card, .search-result-card, .key-projects__card, .editorial-card,
  .home-news__item, .profile-leader, .profile-publication-carousel__card) {
  padding: 8px;
  background: #fff;
}
body :is(.project-card__image, .search-result-card__image, .key-projects__image,
  .editorial-card__image, .home-news__image, .profile-leader > img,
  .profile-publication-carousel__cover, .catalogue-card__image) {
  overflow: hidden;
  border-radius: var(--madep-media-radius);
}
/* White catalogue logos must not expose the old dark gradient at clipped corners. */
body .site-main :is(.project-card__image, .search-result-card__image, .key-projects__image,
  .home-news__image, .editorial-card__image, .home-digest__thumb):has(> img.madep-client-logo) {
  background: #fff;
  border: 0;
  outline: 0;
  box-shadow: none;
}
body.home .key-projects__card,
body.home .site-main .key-projects__image:has(> img.madep-client-logo),
body.home .key-projects__image > img.madep-client-logo {
  background: rgba(255, 255, 255, var(--madep-key-projects-card-opacity, 1));
}
/* The media container owns the curve; images do not draw a second edge. */
body :is(.project-card__image, .search-result-card__image, .key-projects__image,
  .home-news__image, .editorial-card__image, .home-digest__thumb,
  .profile-publication-carousel__cover, .catalogue-card__image) > img {
  border: 0;
  outline: 0;
  box-shadow: none;
  border-radius: 0;
}
body .site-main :is(.project-card__body, .search-result-card__body) { padding: 8px 14px; }
body .site-main :is(.home-digest__feature, .home-digest__card > a, .profile-who__visual) {
  border: 8px solid #fff;
  outline: 1px solid var(--madep-card-line);
}
body .home-digest__slide > a { overflow: hidden; border-radius: var(--madep-media-radius); }
body .home-digest__feature { background: #fff; }
body .home-digest__slide > a { background: #292963; }
body .home-digest__slide > a:has(> img.madep-client-logo),
body .home-digest__card > a:has(> img.madep-client-logo) { background: #fff; }
body .home-digest__card > a::after { border-radius: var(--madep-media-radius); }
body .home-digest__card > a > img { border-radius: var(--madep-media-radius); }
body .profile-who__visual > img { border-radius: var(--madep-media-radius); }
body.home .home-digest__update { padding: 8px; border-radius: 12px; background: #fff; grid-template-columns: 52px minmax(0, 1fr); }
body .home-digest__thumb { position: relative; height: 52px; border-radius: 12px; background: #fff; }
body .profile-page .profile-publications li { border-radius: 12px; }

/* Informative panels keep a steady shadow, even when hovered. */
body :is(.project-information, .editorial-single__panel,
  .project-overview .project-statistics--home, .project-frequency-chart, .project-taxonomy-chart):hover {
  box-shadow: var(--madep-card-shadow);
  transform: none;
}
body .site-main :is(.profile-who__facts article, .profile-value, .profile-relationships__grid article) {
  border: 8px solid #fff;
  outline: 1px solid var(--madep-card-line);
}

@media (hover: hover) and (pointer: fine) {
  body .site-main :is(.project-card, .search-result-card, .key-projects__card, .editorial-card,
    .home-news__item, .home-digest__feature, .home-digest__update,
    .catalogue-card, .project-whats-new):has(a):hover,
  body .site-main :is(.home-digest__card > a, .profile-links a, .capability-overview__grid a, .catalogue-group-links a):hover {
    box-shadow: var(--madep-card-shadow-active);
    transform: translateY(-2px);
  }
}
body .site-main :is(.project-card, .search-result-card, .key-projects__card, .editorial-card,
  .home-news__item, .home-digest__feature, .home-digest__update,
  .catalogue-card, .project-whats-new):focus-within,
body .site-main :is(.home-digest__card > a, .profile-links a, .capability-overview__grid a, .catalogue-group-links a):focus-visible {
  outline: 2px solid #ef7d00;
  outline-offset: 3px;
  box-shadow: var(--madep-card-shadow-active);
}
/* The reference uses a stable image frame; remove the previous image zoom. */
body :is(.key-projects__card, .home-digest__feature, .home-digest__update, .home-digest__card):is(:hover, :focus-within)
  :is(.key-projects__image img, .home-digest__cover, .home-digest__thumb img, img) { transform: none; }

/* Give carousel shadows and the small hover lift room inside scroll viewports. */
body .key-projects__viewport { padding: 8px 6px 20px; }
body .profile-publication-carousel__viewport { padding: 8px 6px 20px; }
body .home-digest__cards { padding: 8px 6px 20px; }

/* Blue replaces pale grey content surfaces only on Home and Profile. */
body.home :is(.home-digest, .home-news, .card-image-placeholder),
.profile-page :is(.profile-who__visual, .profile-vision-mission__grid article,
  .profile-publications, .profile-catalogue, .profile-links a, .profile-leader > img,
  .card-image-placeholder) { background: var(--madep-accent-surface); }
body.home :is(.home-digest--updates-top, .home-digest--news, .home-news) { background: #fff; }
body.home .home-digest--news .home-digest__updates { margin-top: 0; }
@media (min-width: 901px) {
  body.home .home-digest__projects {
    grid-template-rows: auto auto auto;
    row-gap: 14px;
  }
  body.home .home-digest__project-list { display: contents; }
  body.home .home-digest__project-list > .home-digest__heading {
    grid-column: 2;
    grid-row: 1;
    margin-bottom: 0;
  }
  body.home .home-digest__projects > .home-digest__feature {
    grid-column: 1;
    grid-row: 1 / span 2;
    height: auto;
    min-height: 0;
    align-self: stretch;
  }
  body.home .home-digest__project-list > .home-digest__list {
    grid-column: 2;
    grid-row: 2;
  }
  body.home .home-digest__project-list > .home-digest__links {
    grid-column: 2;
    grid-row: 3;
    margin-top: 0;
    padding-top: 0;
  }
}
/* Client, associate and network cards have a continuous white surface. */
body .site-main :is(.catalogue-card, .catalogue-card__image, .catalogue-card__image span) { background: #fff; }
.profile-page .profile-who__overview {
  background: var(--madep-accent-surface);
  box-shadow: 0 0 0 100vmax var(--madep-accent-surface);
}
.profile-page .org-chart { background: var(--madep-accent-surface); }
.profile-page .profile-why__grid {
  padding-block: 28px;
  background: var(--madep-accent-surface);
  box-shadow: 0 0 0 100vmax var(--madep-accent-surface);
  clip-path: inset(0 -100vmax);
}
body .site-main .profile-why__grid article { background: #fff; border-top: 5px solid var(--profile-orange); }
.profile-page .profile-catalogue__filters button {
  color: #14213d;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: normal;
}
.profile-page .profile-catalogue__filters button:hover {
  background: var(--madep-accent-surface);
  color: #14213d;
}
.profile-page .profile-catalogue__filters button[aria-pressed="true"],
.profile-page .profile-catalogue__filters button[aria-pressed="true"]:hover {
  background: #292963;
  color: #fff;
}
body .profile-links a:hover { background: #fff; }

@media (max-width: 640px) {
  body.home .home-digest__update { grid-template-columns: 40px minmax(0, 1fr); }
  body .home-digest__thumb { height: 40px; }
}
/* Home surface controls override older fixed navy backgrounds. */
body.home.banner-below-topbar .site-header { margin-bottom: 0; }
body.home.banner-below-topbar .hero-banner__content { --hero-panel-tab-top: 16px; }
body.home:not(.banner-below-topbar) .hero-banner__content { top: var(--nav-height); --hero-panel-tab-top: 10px; }
body.home .hero-banner__slide--gallery .hero-banner__media { top: 0; height: 100%; }
body.home .hero-banner {
  --madep-banner-height: max(var(--madep-banner-min-height, 540px), var(--madep-banner-height-desktop));
  height: var(--madep-banner-height);
  min-height: var(--madep-banner-min-height, 540px);
}
body.home .hero-banner__media--youtube {
  width: max(100%, calc(var(--madep-banner-height) * 1.7778));
  height: max(100%, 56.25vw);
}
@media (max-width: 900px) {
  body.home .hero-banner {
    --madep-banner-height: max(var(--madep-banner-min-height-mobile, 520px), var(--madep-banner-height-mobile));
    min-height: var(--madep-banner-min-height-mobile, 520px);
  }
}
/* Automatic mode fits the actual space after all bars, without a fixed minimum. */
body.home:not(.banner-custom-height) .hero-banner {
  --madep-banner-height: var(--madep-banner-available-height, var(--madep-banner-height-desktop));
  height: var(--madep-banner-height);
  min-height: 0;
}
@media (max-width: 900px) {
  body.home:not(.banner-custom-height) .hero-banner {
    --madep-banner-height: var(--madep-banner-available-height, var(--madep-banner-height-mobile));
  }
}
body.home.banner-custom-height .hero-banner__content {
  overflow-y: auto;
  justify-content: safe center;
  padding-top: 20px;
  padding-bottom: 60px;
}
body.home.banner-custom-height .hero-banner__content > * { flex-shrink: 0; }
body.home .home-digest__feature .home-digest__caption {
  background: var(--madep-latest_projects-background);
  color: var(--madep-latest_projects-text);
}
body.home .home-digest__feature .home-digest__slide:not(:has(.madep-client-logo)) .home-digest__caption {
  inset: auto 0 0;
  padding: 16px 22px 44px;
}
body.home .home-digest__feature .home-digest__slide > a::after { content: none; }
body.home .home-digest__feature .home-digest__caption :is(time, h3) { color: inherit; }
body.home .home-digest__feature .home-digest__dots button::before {
  background: color-mix(in srgb, var(--madep-latest_projects-text) 40%, transparent);
}
body.home .home-digest__feature .home-digest__dots button[aria-selected="true"]::before { background: var(--madep-latest_projects-text); }
body.home .key-projects .project-shell {
  isolation: isolate;
  background: var(--madep-key_projects-background);
  color: var(--madep-key_projects-text);
}
body.home .key-projects .project-shell::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background-image: var(--key-projects-image, none);
  background-size: cover;
  background-position: 50% var(--madep-key-projects-image-position, 50%);
  opacity: var(--madep-key_projects-opacity, 1);
  pointer-events: none;
}
body.home .key-projects :is(.key-projects__heading h2, .key-projects__heading p, .key-projects__see-all, .key-projects__button) {
  color: var(--madep-key_projects-text);
}
body.home .project-statistics__summary {
  background: var(--madep-statistics-background);
  color: var(--madep-statistics-text);
}
body.home .project-overview .project-statistics__summary :is(h2, .project-statistics__grid strong, .project-statistics__grid span) {
  color: var(--madep-statistics-text);
}
body.home .project-overview .project-statistics__summary .project-statistics__grid > div + div {
  border-left-color: color-mix(in srgb, var(--madep-statistics-text) 30%, transparent);
}
body.home .hero-banner__content {
  background: transparent;
  color: var(--madep-hero-text);
}
body.home .hero-banner__content::before { background: var(--madep-hero-background); }
body.home .hero-banner__content :is(h1, .hero-banner__text) { color: inherit; }
body.home .site-header:not(.is-scrolled):not(.is-mobile-nav-open) {
  background: var(--madep-topbar-background);
  color: var(--madep-topbar-text);
}
body.home .site-header:not(.is-scrolled):not(.is-mobile-nav-open) :is(.site-nav__link, .site-nav__contact, .site-search:not(.is-expanded) button, .site-language__trigger, .site-nav__toggle) {
  color: var(--madep-topbar-text);
}
body.home .site-header:not(.is-scrolled):not(.is-mobile-nav-open) .site-nav__link:is(:hover, :focus-visible, [aria-current="page"]) {
  color: var(--madep-topbar-text);
  background: color-mix(in srgb, var(--madep-topbar-text) 12%, transparent);
}
body.home .site-header:not(.is-scrolled):not(.is-mobile-nav-open) .site-brand img { filter: var(--madep-topbar-logo); }
body.home .site-header:not(.is-scrolled):not(.is-mobile-nav-open) :is(.site-search:not(.is-expanded), .site-language, .site-nav__toggle) {
  border-color: color-mix(in srgb, var(--madep-topbar-text) 40%, transparent);
  background: color-mix(in srgb, var(--madep-topbar-text) 8%, transparent);
}
body.home .site-header:not(.is-scrolled):not(.is-mobile-nav-open) .site-language select option { color: var(--ink); background: #fff; }

@media (prefers-reduced-motion: reduce) {
  body :is(.project-card, .search-result-card, .key-projects__card, .editorial-card,
    .home-news__item, .home-digest__feature, .home-digest__update, .home-digest__card > a,
    .profile-publication-carousel__card, .catalogue-card, .project-whats-new,
    .profile-links a, .capability-overview__grid a, .catalogue-group-links a) {
    transition: none !important;
    transform: none !important;
  }
}

/* Crop only the main card image; client badges retain their layout. */
body.home .key-projects__image > img { object-position:50% var(--key-card-image-position,50%); }

/* The project details panel scrolls independently and shows hover/focus state. */
body.single-project .project-information__content {
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
body.single-project .project-information:hover .project-information__content {
  border-color: #aabbd5;
  background: #fbfcff;
  box-shadow: 0 12px 28px rgba(20, 33, 61, .14);
}
body.single-project .project-information.is-active .project-information__content,
body.single-project .project-information:focus-within .project-information__content {
  outline: 2px solid #ef7d00;
  outline-offset: 2px;
  border-color: #ef7d00;
  background: #fffaf4;
  box-shadow: 0 12px 30px rgba(20, 33, 61, .16);
}
@media (prefers-reduced-motion: reduce) {
  body.single-project .project-information__content { transition: none; }
}
@media (min-width: 801px) {
  body.single-project .project-single__layout > .project-information,
  body.single-project .project-single__layout > .project-information:hover {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
  }
}

/* A home page without a banner starts below the header and keeps its chosen header colors. */
body.home.home-no-banner .site-header {
  margin-bottom: 0;
  background: var(--madep-topbar-background);
  color: var(--madep-topbar-text);
}
body.home.home-no-banner .site-header :is(.site-nav__link, .site-nav__contact, .site-search:not(.is-expanded) button, .site-language__trigger, .site-nav__toggle) {
  color: var(--madep-topbar-text);
}
body.home.home-no-banner .site-header .site-nav__link:is(:hover, :focus-visible, [aria-current="page"]) {
  color: var(--madep-topbar-text);
  background: color-mix(in srgb, var(--madep-topbar-text) 12%, transparent);
}
body.home.home-no-banner .site-header :is(.site-search:not(.is-expanded), .site-language, .site-nav__toggle) {
  border-color: color-mix(in srgb, var(--madep-topbar-text) 40%, transparent);
  background: color-mix(in srgb, var(--madep-topbar-text) 8%, transparent);
}
body.home.home-logo-normal .site-header:not(.is-scrolled):not(.is-mobile-nav-open) .site-brand img,
body.home.home-no-banner.home-logo-normal .site-header .site-brand img { filter: none; }
body.home.home-logo-negative .site-header:not(.is-scrolled):not(.is-mobile-nav-open) .site-brand img,
body.home.home-no-banner.home-logo-negative .site-header .site-brand img { filter: brightness(0) invert(1); }
