/* AP Consulting — site-wide additions outside the page components. */

/* Template portfolio content AP does not use: the old portfolio links, and the Public Funding
   "Selected work" section until it has real case studies. (Home shows /portfolio/ case studies.) */
a[data-aeon-name="About Link"] { display: none !important; }
section[data-aeon-name="Work"]:has(a[href*="portfolio-pf"]) { display: none !important; }
/* Each work card carries an invisible copy of itself as a layout spacer (template placeholder text:
   "Zayla", "Category 1"). Keep its space, but take it out of what screen readers announce. */
[data-aeon-name="Work Card Instance"] [data-aeon-name="SPACING DESKTOP"] { visibility: hidden; }

/* Keep the system cursor visible: people who enlarge or recolour it rely on it. */
body.aeon-cursor-none, body.aeon-cursor-none * { cursor: auto !important; }
body.aeon-cursor-none a, body.aeon-cursor-none button, body.aeon-cursor-none [role="button"],
body.aeon-cursor-none label, body.aeon-cursor-none summary { cursor: pointer !important; }
body.aeon-cursor-none input, body.aeon-cursor-none textarea { cursor: text !important; }

/* Visible keyboard focus everywhere (WCAG 2.4.7): white ring with a dark halo reads on black, blue and orange. */
:focus-visible { outline: 3px solid #fff !important; outline-offset: 2px !important; box-shadow: 0 0 0 5px #000 !important; }

/* Links written inside page text. */
[data-aeon-name^="Text – Whether"] a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* Skip link (WCAG 2.4.1). */
.ap-skip {
  position: fixed; left: 16px; top: -120px; z-index: 2147483647;
  background: #fff; color: #000; padding: 12px 18px; border-radius: 8px;
  font: 600 16px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif; text-decoration: none;
}
.ap-skip:focus { top: 16px; }

/* Language and cookie settings dock. */
.ap-dock { position: fixed; left: 16px; bottom: 16px; z-index: 2147483000; display: flex; gap: 8px; }
.ap-dock-btn {
  min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(18, 18, 18, .88); color: #fff; border: 1px solid rgba(255, 255, 255, .35);
  font: 600 14px/1 system-ui, -apple-system, "Segoe UI", sans-serif; text-decoration: none;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.ap-dock-btn:hover { background: #000; border-color: #fff; }
.ap-motion-btn { padding: 0; }
.ap-motion-btn svg { display: block; }
.ap-motion-btn[aria-pressed="true"], .ap-motion-btn[aria-pressed="true"]:hover { background: #fff; color: #000; border-color: #fff; }

/* Cookie banner: Accept, Reject and Choose carry equal weight (EDPB cookie banner report). */
.ap-cc {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 2147483600;
  max-width: 560px; margin-left: auto; box-sizing: border-box;
  background: #111; color: #fff; border: 1px solid rgba(255, 255, 255, .25); border-radius: 16px;
  padding: 20px; box-shadow: 0 24px 64px rgba(0, 0, 0, .45);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  /* never taller than the screen (landscape phones with "Choose" open): scroll inside instead */
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain;
}
.ap-cc-title { margin: 0 0 8px; font-size: 18px; font-weight: 700; color: #fff; }
.ap-cc-body { margin: 0 0 14px; color: #e6e6e6; }
.ap-cc-body a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.ap-cc-settings { margin: 0 0 14px; display: grid; gap: 10px; }
.ap-cc-settings[hidden] { display: none; }
.ap-cc-row { display: flex; gap: 12px; align-items: flex-start; }
.ap-cc-row input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: #ee620d; flex: none; }
.ap-cc-row label { display: grid; gap: 2px; color: #e6e6e6; }
.ap-cc-row strong { color: #fff; }
.ap-cc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-cc-btn {
  flex: 1 1 140px; min-height: 48px; padding: 0 18px; border-radius: 24px;
  background: #fff; color: #000; border: 1px solid #fff;
  font: 600 15px/1 system-ui, -apple-system, "Segoe UI", sans-serif; cursor: pointer;
}
.ap-cc-btn:hover { background: #ee620d; border-color: #ee620d; color: #000; }

@media (forced-colors: active) {
  .ap-cc, .ap-dock-btn, .ap-cc-btn { border: 1px solid CanvasText; }
}

/* Text for screen readers only (used by the animated text and counters). */
.ap-sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* Public Funding (blue): the team cards share one orange background image with Digitalization.
   Turn it blue on this page only, to match the blue-lit portraits. (.aeon-0x4DD = Public Funding page root) */
.aeon-0x4DD [data-aeon-name*="Team Member Card"] img[src*="image-c7dc26f3"] {
  filter: hue-rotate(190deg) saturate(1.15);
}

/* Public Funding / Contact / 404 layout (.aeon-1ZvWO): the fixed nav is 1300px wide with max-width:100%,
   so below 1300px it ran edge to edge and, under 390px, the links overlapped the logo.
   Give it the same side gutters as the Home nav (50px, 20px under 1200px, 15px on phones).
   The "nav" in the selectors outranks the page's inline rule, which loads after this file. */
.aeon-1ZvWO nav.aeon-1ulgicv { max-width: calc(100% - 100px); }
@media (max-width: 1199.98px) { .aeon-1ZvWO nav.aeon-1ulgicv { max-width: calc(100% - 40px); } }
@media (max-width: 809.98px) {
  .aeon-1ZvWO nav.aeon-1ulgicv { max-width: calc(100% - 30px); }
  .aeon-1ZvWO nav.aeon-1ulgicv .aeon-fw0jv7 { width: auto; } /* logo box is 21% of the nav: narrower than the logo on phones */
  .aeon-1ZvWO nav.aeon-1ulgicv .aeon-nmiBT.aeon-1je7c4c { gap: 24px; }
}
@media (max-width: 389.98px) {
  .aeon-1ZvWO nav.aeon-1ulgicv { max-width: calc(100% - 24px); }
  .aeon-1ZvWO nav.aeon-1ulgicv .aeon-nmiBT.aeon-1je7c4c { gap: 10px; }
}

/* Phones and tablets: template text that was only sized for desktop.
   1. Phones: the big scroll headline (Digitalization .aeon-1wgrriu, Public Funding .aeon-ofkehl) keeps the 90px
      desktop size while its line height drops to 37px, so lines overlapped and long words were split
      ("Digitaliz-amos"). Use the same tight leading as on desktop (line ≈ 0.72 × size) and scale with the
      screen so the longest word fits at 320px. The words take their size from --aeon-font-size; the italic
      words have their own (95 against 90). */
@media (max-width: 809.98px) {
  .aeon-1wgrriu > h2, .aeon-ofkehl > h2 { --aeon-font-size: min(51px, 15.5vw) !important; }
  .aeon-1wgrriu > h2 span[style*="--aeon-font-size"], .aeon-ofkehl > h2 span[style*="--aeon-font-size"] { --aeon-font-size: min(54px, 16.4vw) !important; }
  /* 2. The "Subline" text blocks were 8px wider than a 320px screen. */
  [data-aeon-name="Subline"] [data-aeon-name="Content Group"] { max-width: 100%; }
}
@media (max-width: 1199.98px) {
  /* 3. Footer heading ("Your next funded project starts here."): one unbreakable line, cut off on phones. */
  footer[data-aeon-name="Footer Region"] div:has(> h2) { max-width: 100%; white-space: normal; }
  footer[data-aeon-name="Footer Region"] h2 { white-space: normal; text-align: center; text-wrap: balance; }
}
/* 4. Rows that did not wrap: the footer's legal links (phones and tablets) and the service tags on Public
      Funding (the Portuguese ones are longer). Full width, so they wrap into rows, not a column; the links
      get 24px-high targets (WCAG 2.5.8). */
footer[data-aeon-name="Footer Region"] [data-aeon-name="Social-Links"] { flex-wrap: wrap !important; row-gap: 4px; }
footer[data-aeon-name="Footer Region"] [data-aeon-name="Social-Links"] a { display: inline-block; padding: 4px 0; }
@media (min-width: 810px) { /* beside the copyright line: take the space left, wrap within it */
  footer[data-aeon-name="Footer Region"] [data-aeon-name="Social-Links"] { flex: 1 1 0 !important; min-width: 0; justify-content: flex-end; }
}
@media (max-width: 809.98px) {
  footer[data-aeon-name="Footer Region"] [data-aeon-name="Social-Links"] { width: 100%; max-width: 100%; }
}
[data-aeon-name="Tags"] { flex-wrap: wrap !important; width: 100%; max-width: 100%; row-gap: 8px; }
/* 5. Timeline step titles ("Desenvolvimento do projeto") were one unbreakable line, cut on narrow phones. */
@media (max-width: 809.98px) {
  [data-aeon-name="Timeline item"] div:has(> h4) { max-width: 100%; white-space: normal; }
  [data-aeon-name="Timeline item"] h4 { white-space: normal !important; }
}
/* 8. Service cards are 360px wide on phones: on screens under 390px their right side was cut off.
      Fit the card and its text to the screen. */
@media (max-width: 389.98px) {
  :is([data-aeon-name="Format1"], [data-aeon-name="Format2"], [data-aeon-name="Format3"]),
  :is([data-aeon-name="Format1"], [data-aeon-name="Format2"], [data-aeon-name="Format3"]) [data-aeon-name="Content Group"],
  :is([data-aeon-name="Format1"], [data-aeon-name="Format2"], [data-aeon-name="Format3"]) div:has(> p) { max-width: 100% !important; }
}
/* When the page scrolls to a focused element, keep it clear of the language/cookie/pause buttons fixed at
   the bottom of the screen (WCAG 2.4.11). */
html { scroll-padding-bottom: 84px; }
/* 6. Public Funding hero in Portuguese: the title is fitted to the width of "Public Funding" (font 218.6 in a
      1300-wide box). "Financiamento Público" is ~1.5× longer, wrapped, and "Público" fell outside the box.
      Size it so the whole title fits on one line, centred in the same space. (.aeon-0x4DD = Public Funding) */
html[lang="pt-PT"] .aeon-0x4DD .aeon-fit-text h1 { --aeon-font-size: 140px !important; padding-top: 50px; }
/* 7. Narrowest phones (Galaxy Fold folded, 280px): logo and three links do not fit in the Public Funding /
      Contact / 404 nav. Drop the decorative 01/02/03 next to the links. */
@media (max-width: 319.98px) {
  .aeon-1ZvWO nav.aeon-1ulgicv [data-aeon-name="Roll No"] { display: none; }
}
/* 9. Digitalization mobile menu: the open panel is fixed to the screen and was taller than a landscape phone
      ("Contacto" out of reach). Let it scroll, and hide the language/cookie buttons while it is open. */
@media (max-width: 809.98px) {
  .aeon-OU8D6 div.aeon-wz3pqn-container { max-height: 100vh; max-height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
}
body:has(.aeon-wz3pqn-container [role="button"][aria-expanded="true"]) .ap-dock { display: none; }

/* Team cards link to the profile pages (/team/<slug>, scripts/team_links.py). The link covers the card for
   keyboard users and search engines; it lets the mouse through so the card keeps its hover motion, and
   site.js follows it on a click anywhere on the card. */
[data-aeon-name="Team Member Card Instance"]:has(.ap-team-link) { cursor: pointer; }
.ap-team-link { position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none; }
.ap-team-link:focus-visible { outline-offset: -3px !important; }
