/* ============================================================================
 * Site - custom styles on top of the Tailwind build (assets/css/site.css)
 * Brand colours come from CSS variables set in Admin → Branding.
 * ============================================================================ */

html, body { max-width: 100%; overflow-x: hidden; }

.font-serif-hero { font-family: 'EB Garamond', Georgia, serif; }

/* Logo size (Admin → Branding → Logo height) */
.site-logo { height: calc(var(--logo-h, 56px) * .86); }
@media (min-width: 768px) { .site-logo { height: var(--logo-h, 56px); } }

/* Angled shapes */
.slanted-nav-desktop { clip-path: polygon(36px 0, 100% 0, 100% 100%, 0% 100%); }
.slanted-accent-red  { clip-path: polygon(18px 0, 100% 0, 100% 100%, 0% 100%); }
.slanted-badge       { clip-path: polygon(14px 0, 100% 0, 100% 100%, 0% 100%); }

/* ---------------------------------------------------------------------------
 * Site header: logo on white, transparent over the hero, slanted blue menu bar + red corner
 * ------------------------------------------------------------------------- */
:root { --hdr-h: 94px; }
.ag-header__fade, .ag-header__red { display: none; }
.ag-header__row { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; }
.ag-header__logo { display: flex; align-items: center; flex-shrink: 0; padding: 6px 0; }
.ag-header__nav { display: none; }
#mobileMenu { position: relative; z-index: 2; }
@media (min-width: 640px) { .ag-header__row { padding-left: 24px; padding-right: 24px; } }

@media (min-width: 1024px) {
  /* Desktop: the header floats transparently over the first section (hero / page banner) */
  .ag-header { position: absolute; top: 0; left: 0; right: 0; min-height: var(--hdr-h); overflow: visible; background: transparent !important; }
  .ag-header.is-stuck { position: fixed; background: rgba(255,255,255,.96) !important; }
  .ag-under-header { padding-top: calc(var(--hdr-h) + 48px) !important; }
  .ag-banner { height: calc(320px + var(--hdr-h)) !important; padding-top: var(--hdr-h); }
  .ag-header__fade { display: block; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, #fff 0, #fff 27%, rgba(255,255,255,.75) 33%, rgba(255,255,255,.25) 38%, rgba(255,255,255,0) 42%); }
  .ag-header__red { display: block; position: absolute; top: 0; right: 0; z-index: 1; width: 18.5%; height: calc(var(--hdr-h) - 8px); clip-path: polygon(0 0, 100% 0, 100% 100%, 38px 100%); }
  .ag-header__row { min-height: var(--hdr-h); padding: 0 clamp(14px, 1.8vw, 40px) 0 clamp(24px, calc((100vw - 1240px) / 2), 400px); }
  .ag-header__logo { padding: 10px 0; }
  .ag-header .site-logo { height: min(var(--logo-h, 72px), calc(3.2vw + 26px)); max-height: calc(var(--hdr-h) - 16px); }
  .ag-header__nav { display: flex; align-items: stretch; justify-content: center; flex: 1; align-self: flex-start; height: 46px; margin: 20px 0 0 clamp(16px, calc(8vw - 60px), 58px); padding: 0 clamp(18px, calc(14vw - 125px), 110px) 0 clamp(50px, calc(7vw - 30px), 90px); position: relative; isolation: isolate; }
  .ag-header__nav::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgb(var(--brand-blue)); clip-path: polygon(0 0, 100% 0, 100% 100%, 46px 100%); }
  .ag-header__nav > ul { position: relative; z-index: 1; }
  .ag-header__nav > ul { display: flex; align-items: stretch; gap: clamp(0px, calc(2.4vw - 22px), 14px); color: #fff; }
  .ag-header__nav > ul > li { display: flex; align-items: center; }
  .ag-nav-link { position: relative; display: flex; align-items: center; gap: 7px; height: 100%; padding: 0 clamp(6px, .55vw, 9px); color: #fff; font-family: Roboto, Rubik, sans-serif; font-weight: 700; font-size: clamp(14px, 1.22vw, 18px); white-space: nowrap; transition: color .2s; }
  .ag-nav-link:hover { color: #fecaca; }
  .ag-nav-link.is-active::after { content: ""; position: absolute; left: clamp(6px, .55vw, 9px); right: clamp(6px, .55vw, 9px); bottom: 7px; height: 3px; background: rgb(var(--brand-red)); }
  .ag-nav-caret { font-size: .62em; margin-top: 1px; }
  .ag-header__nav .dropdown-menu { top: 100%; }
}

.textured-bg {
  background-color: #F8F9FA;
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.02) 0, rgba(0,0,0,.02) 2px, transparent 2px, transparent 6px);
}

/* Desktop dropdown menus */
.dropdown-menu { display: block; opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity .2s ease, transform .2s ease, visibility .2s; }
.group:hover > .dropdown-menu, .group:focus-within > .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }

/* Sticky header (Admin → Header & Footer) */
#siteHeader.is-stuck { position: fixed !important; top: 0; left: 0; right: 0; animation: agSlideDown .25s ease; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
@keyframes agSlideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* Rich text written in the admin editor */
.ag-rich p { margin-bottom: 1rem; }
.ag-rich p:last-child { margin-bottom: 0; }
.ag-rich h3 { font-size: 1.125rem; font-weight: 700; color: #222; margin: 1.25rem 0 .5rem; }
.ag-rich a { color: rgb(var(--brand-red)); text-decoration: underline; }
.ag-rich ul { list-style: disc; padding-left: 1.25rem; margin-bottom: 1rem; }
.ag-rich--career p { font-size: 15px; margin-bottom: 1.5rem; }
.ag-rich--career h3 + p { font-size: .875rem; }

.ag-prose { color: #374151; font-size: 15px; line-height: 1.75; }
.ag-prose :where(h2) { color: #222; font-weight: 700; font-size: 1.5rem; margin: 1.75rem 0 1rem; }
.ag-prose :where(h3) { color: #222; font-weight: 700; font-size: 1.25rem; margin: 1.5rem 0 .75rem; }
.ag-prose :where(h2:first-child, h3:first-child) { margin-top: 0; }
.ag-prose :where(a) { color: rgb(var(--brand-red)); }
.ag-prose :where(strong) { color: #1f2937; }
.ag-prose :where(img) { max-width: 100%; height: auto; }
.ag-prose :where(table) { width: 100%; }
.ag-prose :where(ul > li)::marker { color: rgb(var(--brand-red)); }

/* Honeypot (spam trap) */
.ag-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* Form validation */
.ag-invalid { border-color: #ef4444 !important; box-shadow: 0 0 0 3px rgba(239,68,68,.12) !important; }
.ag-submit.is-loading { opacity: .85; cursor: progress; }
.ag-fade-in { animation: agFade .4s ease both; }
@keyframes agFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================ Popups ============================ */
.ag-modal-lock, .ag-modal-lock body { overflow: hidden !important; }
.ag-modal { position: fixed; inset: 0; z-index: 9990; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ag-modal[hidden] { display: none; }
.ag-modal__backdrop { position: absolute; inset: 0; background: rgba(8, 15, 30, .72); backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s ease; }
.ag-modal__panel {
  position: relative; width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; background: #fff;
  border-top: 5px solid rgb(var(--brand-red)); box-shadow: 0 30px 80px rgba(0,0,0,.35);
  transform: translateY(18px) scale(.98); opacity: 0; transition: transform .22s ease, opacity .22s ease;
}
.ag-modal.is-open .ag-modal__backdrop { opacity: 1; }
.ag-modal.is-open .ag-modal__panel { transform: none; opacity: 1; }
.ag-modal__close {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 999px; z-index: 2;
  color: #6b7280; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: background .15s, color .15s;
}
.ag-modal__close:hover { background: #f3f4f6; color: rgb(var(--brand-red)); }
.ag-modal__head { display: flex; gap: 16px; align-items: flex-start; padding: 28px 28px 18px; border-bottom: 1px solid #f1f5f9; background: linear-gradient(180deg, #f8fafc, #fff); }
.ag-modal__icon { flex: none; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: rgb(var(--brand-navy)); color: #fff; font-size: 20px; clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%); }
.ag-modal__body { padding: 22px 28px 28px; }
@media (max-width: 640px) { .ag-modal__head, .ag-modal__body { padding-left: 18px; padding-right: 18px; } .ag-modal__icon { display: none; } }

.ag-result-icon { width: 76px; height: 76px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-size: 34px; color: #fff; }
.ag-result-icon.is-success { background: #16a34a; box-shadow: 0 0 0 10px rgba(22,163,74,.12); animation: agPop .35s ease; }
.ag-result-icon.is-error { background: rgb(var(--brand-red)); box-shadow: 0 0 0 10px rgb(var(--brand-red) / .12); animation: agPop .35s ease; }
@keyframes agPop { 0% { transform: scale(.6); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* ============================ Floating buttons ============================ */
.ag-floating { position: fixed; right: 18px; bottom: 18px; z-index: 9000; display: flex; flex-direction: column; gap: 12px; align-items: flex-end; }
.ag-floating--left { right: auto; left: 18px; align-items: flex-start; }
.ag-fab { position: relative; min-width: 54px; height: 54px; border-radius: 999px; display: flex; align-items: center; justify-content: center; gap: 10px; color: #fff; font-size: 26px; box-shadow: 0 10px 25px rgba(0,0,0,.25); transition: transform .2s, opacity .2s, box-shadow .2s; text-decoration: none; }
.ag-fab:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(0,0,0,.3); color: #fff; }
.ag-fab__label { display: none; font-size: 14px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; font-family: Roboto, Arial, sans-serif; }
@media (min-width: 1024px) {
  .ag-fab--pill { padding: 0 22px 0 18px; }
  .ag-fab--pill .ag-fab__label { display: inline; }
}
.ag-fab--wa { background: #25D366; }
.ag-fab--call { background: rgb(var(--brand-red)); font-size: 21px; }
.ag-fab--top { background: rgb(var(--brand-navy)); font-size: 16px; min-width: 42px; width: 42px; height: 42px; opacity: 0; pointer-events: none; }
.ag-fab--top.is-visible { opacity: 1; pointer-events: auto; }
.ag-fab--pulse::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: inherit; z-index: -1; animation: agPulse 2.2s ease-out infinite; }
@keyframes agPulse { 0% { transform: scale(1); opacity: .55; } 80%, 100% { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ag-fab--pulse::before { animation: none; } }
@media (max-width: 1023px) { .ag-only-desktop { display: none !important; } }
@media (min-width: 1024px) { .ag-only-mobile { display: none !important; } }

/* ============================ Lightbox ============================ */
.ag-lightbox { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; padding: 24px; }
.ag-lightbox img { max-width: 100%; max-height: 88vh; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.ag-lightbox__close { position: absolute; top: 14px; right: 20px; color: #fff; font-size: 40px; line-height: 1; }
.ag-lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); color: #fff; font-size: 54px; padding: 0 14px; opacity: .8; }
.ag-lightbox__nav:hover { opacity: 1; }
.ag-lightbox__nav.is-prev { left: 6px; }
.ag-lightbox__nav.is-next { right: 6px; }
