/* =========================================================================
   ACE Trust palette override
   Loaded AFTER main.css. Redefines the template's colour variables so the
   whole site follows the logo without editing main.css (keeps the theme
   upgradeable).

   Logo sampled: #6796CE blue · #929497 mid grey · #BBBDC1 light grey

   Note on contrast: the logo blue measures 3.07:1 on white, which fails
   WCAG AA for body-size text. It is therefore used for fills, graphics and
   large display type only; #2E5C8F carries text and interactive elements.
   ========================================================================= */

:root {
  /* Logo-true */
  --ace-blue:        #6796CE;  /* logo blue — fills, graphics, large type */
  --ace-grey:        #929497;  /* logo mid grey */
  --ace-grey-light:  #BBBDC1;  /* logo light grey */

  /* Derived, contrast-safe */
  --ace-blue-deep:   #2E5C8F;  /* 6.90:1 on white — buttons, links, figures */
  --ace-blue-soft:   #8FB3DC;  /* decorative tint only */
  --ace-navy:        #1C3557;  /* 12.38:1 — headings, dark surfaces */
  --ace-tint:        #EDF2F8;  /* pale section backgrounds */
  --ace-muted:       #63696E;  /* 5.56:1 — secondary body copy */

  /* --- remap the template's accounting palette --- */
  --tp-accounting-primary:   var(--ace-blue);
  --tp-accounting-secondary: var(--ace-blue-soft);
  --tp-accounting-3:         var(--ace-blue-deep);
  --tp-accounting-gray:      var(--ace-tint);
  --tp-accounting-brown:     var(--ace-navy);
  --tp-accounting-wood:      var(--ace-muted);
}

.theme-accounting {
  --tp-theme-primary:   var(--ace-blue);
  --tp-theme-secondary: var(--ace-blue-soft);
  --tp-theme-3:         var(--ace-blue-deep);
  --tp-theme-gray:      var(--ace-tint);
  --tp-theme-brown:     var(--ace-navy);
  --tp-theme-wood:      var(--ace-muted);
}

/* Buttons: the template fills with primary; use the deep blue so white
   button text clears 4.5:1. */
.theme-accounting .tp-btn-accounting-style:not(.tp-btn-border) {
  background-color: var(--ace-blue-deep);
  border-color: var(--ace-blue-deep);
  color: #FFFFFF;
}
.theme-accounting .tp-btn-accounting-style.tp-btn-border {
  border-color: var(--ace-blue-deep);
  color: var(--ace-blue-deep);
}

/* Counters and stat figures read as data — keep them contrast-safe. */
.tp-cc-fact-item-text,
.tp-about-fact-item-title,
.tp-at-hero-card-title {
  color: var(--ace-blue-deep);
}

/* Eyebrow labels ("// Business impact", "Who we are") */
.tp-section-sub,
.tp-section-at-subtitle {
  color: var(--ace-blue-deep);
}

/* Dark surfaces (footer, hero cards) */
[data-bg-color="#3A1510"],
.tp-footer-5-area {
  background-color: var(--ace-navy) !important;
}

/* ---- About section sub-navigation ---- */
.tp-about-subnav-link,
.tp-section-nav-link {
  display: inline-block;
  padding: 9px 20px;
  border: 1px solid var(--ace-grey-light);
  border-radius: 40px;
  font-size: 15px;
  line-height: 1.2;
  color: var(--ace-muted);
  text-decoration: none;
  transition: all .25s ease;
}
.tp-about-subnav-link:hover,
.tp-section-nav-link:hover {
  border-color: var(--ace-blue-deep);
  color: var(--ace-blue-deep);
}
.tp-about-subnav-link.is-active,
.tp-section-nav-link.is-active {
  background-color: var(--ace-blue-deep);
  border-color: var(--ace-blue-deep);
  color: #FFFFFF;
}

/* ---- Filter buttons reuse the section-nav pill, but as <button> ---- */
button.tp-section-nav-link {
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}
button.tp-section-nav-link.is-active {
  background-color: var(--ace-blue-deep);
}

/* ---- Programme card links ---- */
.tp-fa-control-item-title a {
  color: inherit;
  text-decoration: none;
}

/* ---- Simple horizontal share bar (Impact: value gain) ---- */
.ace-bar {
  height: 10px;
  border-radius: 999px;
  background-color: rgba(103, 150, 206, 0.22);
  overflow: hidden;
}
.ace-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background-color: var(--ace-blue-deep);
}

/* ---- Header: nine top-level items on one line ----
   The theme spaces these with per-item margins sized for five items. Rather
   than guessing at its values, zero them and drive spacing from a single
   `gap`, so the row width is predictable. Selectors are deliberately more
   specific than the theme's to win without !important. */

.tp-header-area .tp-header-menu {
  min-width: 0;                 /* a flex/grid child will not shrink without this */
}

.tp-header-area .tp-header-menu nav > ul {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 0;
  max-width: 100%;
  /* Scales with viewport: 6px at 1200px, ~14px at 1920px. */
  gap: clamp(6px, 0.72vw, 16px);
}

.tp-header-area .tp-header-menu nav > ul > li {
  margin: 0;
  padding: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}

.tp-header-area .tp-header-menu nav > ul > li > a {
  white-space: nowrap;
  padding-left: 0;
  padding-right: 0;
  /* 13px on a small laptop up to 16px on a large monitor. */
  font-size: clamp(13px, 0.83vw, 16px);
}

/* Actions must be allowed to shrink rather than push the row wider. */
.tp-header-area .tp-header-action {
  min-width: 0;
  flex-wrap: nowrap;
}
.tp-header-area .tp-header-action .ml-40 {
  margin-left: clamp(12px, 1.2vw, 40px);
}
.tp-header-area .tp-at-header-contact a {
  white-space: nowrap;
}

/* Right-hand dropdowns must open inward, not off the edge of the page. */
.tp-header-area .tp-header-menu nav > ul > li:nth-last-child(-n+3) .tp-submenu {
  left: auto;
  right: 0;
}

/* Last resort: never let the header cause a horizontal scrollbar. */
.tp-header-area {
  overflow-x: clip;
}

/* ---- Dropdowns ----
   `white-space` inherits, so the nowrap set on the top-level items above
   cascaded into the submenus and pushed long labels such as "Project Design
   & Implementation" out of the theme's fixed-width box. Reset it here, and
   let the panel size itself to its widest item within sane bounds. */

.tp-header-area .tp-header-menu nav > ul > li .tp-submenu {
  width: max-content;
  min-width: 230px;
  /* Never wider than the viewport allows on a small laptop. */
  max-width: min(340px, 90vw);
}

.tp-header-area .tp-header-menu nav > ul > li .tp-submenu li,
.tp-header-area .tp-header-menu nav > ul > li .tp-submenu li > a {
  white-space: normal;   /* wrap inside the panel instead of overflowing it */
  overflow-wrap: break-word;
}

/* Wrapped items need a little breathing room between lines. */
.tp-header-area .tp-header-menu nav > ul > li .tp-submenu li > a {
  line-height: 1.45;
}

/* The offcanvas menu is a clone of the same markup — keep it wrapping too. */
.tp-offcanvas-menu nav ul li,
.tp-offcanvas-menu nav ul li > a {
  white-space: normal;
}

/* ---- Governance: photo card, details on hover ----
   At rest the card shows the photograph only. On hover or keyboard focus a
   white panel covers it and the name, role and biography fade in. Layout
   properties are forced because the theme's own rules are more specific. */

.tp-at-team-item {
  position: relative !important;
  display: block;
  overflow: hidden;
  border-radius: 8px;
  aspect-ratio: 3 / 4;          /* consistent card height across the row */
  background: var(--ace-tint);
  isolation: isolate;
}

.tp-at-team-item::before,
.tp-at-team-item::after {
  content: none !important;
}

/* Photo fills the card. */
.tp-at-team-item-thumb {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  overflow: hidden;
  display: flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  filter: none !important;
  opacity: 1 !important;
  z-index: 1;
}

.tp-at-team-item-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  object-position: center top;
  display: block;
  border-radius: 0;
  filter: none !important;
  transition: transform .45s ease;
}

.tp-at-team-item:hover .tp-at-team-item-thumb img,
.tp-at-team-item:focus-within .tp-at-team-item-thumb img {
  transform: scale(1.04);
}

.tp-at-team-initials {
  font-size: 40px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--ace-blue-deep);
}

/* Panel is invisible at rest — nothing shows over the photograph. */
.tp-at-team-item-content {
  position: absolute !important;
  inset: 0 !important;
  z-index: 2;
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  padding: 24px !important;
  width: 100% !important;
  transform: none !important;
  visibility: visible !important;

  background: rgba(255, 255, 255, 0);
  opacity: 0 !important;
  pointer-events: none;         /* not clickable while hidden */
  transition: background .35s ease, opacity .3s ease;
}

.tp-at-team-item:hover .tp-at-team-item-content,
.tp-at-team-item:focus-within .tp-at-team-item-content {
  background: rgba(255, 255, 255, 0.97);
  opacity: 1 !important;
  pointer-events: auto;
}

.tp-at-team-item-content .tp-fa-control-item-title {
  color: var(--ace-navy);
  font-size: 19px;
  line-height: 1.3;
  margin-bottom: 2px;
}

.tp-at-team-role {
  display: block;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ace-blue-deep);
  text-decoration: none;
  border-bottom: 0;
}

.tp-at-team-bio {
  margin: 14px 0 0 !important;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ace-muted);
  overflow-wrap: break-word;
  max-height: 62%;
  overflow-y: auto;             /* a long biography scrolls inside the panel */
}

/* Touch devices have no hover: show the panel by default there. */
@media (hover: none) {
  .tp-at-team-item-content {
    background: rgba(255, 255, 255, 0.97);
    opacity: 1 !important;
    pointer-events: auto;
  }
}

/* Visible focus ring for keyboard users reaching the cards. */
.tp-at-team-item:focus-visible {
  outline: 3px solid var(--ace-blue-deep);
  outline-offset: 3px;
}

/* ---- Hero: readable copy, without touching slider layout ----
   An earlier attempt set position/overflow on .tp-at-hero-item-thumb and
   broke the slider — the theme positions that element itself. Nothing here
   changes layout: the image is only filtered, and the contrast comes from a
   panel behind the copy, which is inside the content block and cannot affect
   how slides are stacked or sized. */

.tp-at-hero-item-thumb img {
  filter: blur(3px) saturate(1.04);
  transform: scale(1.05);   /* hides the soft edge blur leaves behind */
}

/* Frosted panel behind the eyebrow, headline and button. */
.tp-at-hero-item .tp-at-hero-content {
  display: inline-block;
  max-width: 100%;
  padding: 26px 32px 30px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* Same treatment for the supporting paragraph. */
.tp-at-hero-item .tp-fi-hero-sub {
  padding: 18px 22px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* Fixed text colours — the three photographs differ in brightness. */
.tp-at-hero-item .tp-cn-hero-title { color: var(--ace-navy); }
.tp-at-hero-item .tp-cn-hero-sub   { color: var(--ace-blue-deep); }
.tp-at-hero-item .tp-fi-hero-sub p { color: #24303f; }

@media (max-width: 767px) {
  .tp-at-hero-item .tp-at-hero-content { padding: 20px 20px 24px; }
  .tp-at-hero-item .tp-fi-hero-sub     { padding: 14px 16px; }
}

/* ---- Hero: keep the paragraph clear of the stat cards ----
   The cards are pinned bottom-right by the theme. The supporting paragraph
   spans the full row, so it ran underneath them. Constrain the paragraph's
   width instead of moving anything — no positioning is changed here. */

@media (min-width: 1400px) {
  .tp-at-hero-item .tp-fi-hero-sub { max-width: 56%; }
}

@media (min-width: 1200px) and (max-width: 1399px) {
  .tp-at-hero-item .tp-fi-hero-sub { max-width: 52%; }
}

/* 992-1199px is the tightest case: the cards take the same pixel width but
   the container is much narrower, so the paragraph has to give up more. */
@media (min-width: 992px) and (max-width: 1199px) {
  .tp-at-hero-item .tp-fi-hero-sub { max-width: 44%; }
}

/* Below 992px the cards stack under the copy, so the paragraph can run full
   width — it just needs room beneath it. */
@media (max-width: 991px) {
  .tp-at-hero-item .tp-fi-hero-sub {
    max-width: 100%;
    margin-bottom: 30px;
  }
}

/* ---- Hero: gap between the headline panel and the paragraph panel ---- */
.tp-at-hero-item .tp-at-hero-content {
  margin-bottom: 18px;
}
