/*
 * Browser Compatibility — AusInd Bridge Foundation
 *
 * Ensures consistent rendering across Chrome, Firefox, Safari (iOS & macOS),
 * Edge, and other modern browsers. Vendor prefixes, polyfill shims,
 * accessibility improvements, and sensible fallback values.
 */

/* ════════════════════════════════════════════════════════════════
   BASE RESETS & CROSS-BROWSER NORMALISATION
   ════════════════════════════════════════════════════════════════ */

/* Prevent iOS Safari font-size inflation on orientation change */
/* background-color: #fff ensures that whenever body is transparent (during
   page transitions or translation), white shows instead of black/dark. */
html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: #ffffff !important;
}

/* Smooth scrolling — with reduced-motion respect */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Remove tap highlight on iOS/Android */
a,
button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

/* Box-sizing across all browsers */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ════════════════════════════════════════════════════════════════
   SAFARI — STICKY POSITIONING
   Older Safari requires the -webkit- prefix for position: sticky
   ════════════════════════════════════════════════════════════════ */
nav,
[style*="position: sticky"],
.sticky {
  position: -webkit-sticky;
  position: sticky;
}

/* ════════════════════════════════════════════════════════════════
   IMAGES & MEDIA — cross-browser consistency
   ════════════════════════════════════════════════════════════════ */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

/* object-fit fallback value for any browser that skips it */
img {
  -o-object-fit: cover;
  object-fit: cover;
}

/* ════════════════════════════════════════════════════════════════
   VIDEO — autoplay compatibility
   iOS Safari requires muted + playsinline for autoplay.
   Ensure any video without these attributes gets them enforced via JS.
   ════════════════════════════════════════════════════════════════ */
video[autoplay] {
  /* CSS cannot set attributes; this comment documents the requirement:
     <video autoplay muted loop playsinline> is the correct cross-browser
     pattern — all four attributes are present in the hero markup. */
}

/* ════════════════════════════════════════════════════════════════
   FORMS — cross-browser input normalisation
   ════════════════════════════════════════════════════════════════ */
input,
textarea,
select,
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 0;
}

/* Restore button cursor */
button,
[type="button"],
[type="reset"],
[type="submit"] {
  cursor: pointer;
}

/* iOS: prevent zoom on focus for font-size < 16px inputs */
input[type="text"],
/* input[type="email"], */
input[type="tel"],
input[type="number"],
input[type="search"],
textarea,
select {
  font-size: max(16px, 1rem);
}

input[type="email"] {
  font-size: max(12px, 0.5rem);
}

/* ════════════════════════════════════════════════════════════════
   FLEXBOX GAP — Safari < 14.1 compatibility shim
   Tailwind generates gap-* on flex containers; older iOS Safari
   doesn't support gap on flex containers (only CSS Grid).
   This shim uses row-gap + column-gap which has wider support.
   ════════════════════════════════════════════════════════════════ */
.flex.gap-8 {
  row-gap: 2rem;
  column-gap: 2rem;
}

.flex.gap-6 {
  row-gap: 1.5rem;
  column-gap: 1.5rem;
}

.flex.gap-4 {
  row-gap: 1rem;
  column-gap: 1rem;
}

.flex.gap-3 {
  row-gap: 0.75rem;
  column-gap: 0.75rem;
}

.flex.gap-2 {
  row-gap: 0.5rem;
  column-gap: 0.5rem;
}

/* ════════════════════════════════════════════════════════════════
   SAFARI — OVERFLOW SCROLL SMOOTHNESS (iOS)
   ════════════════════════════════════════════════════════════════ */
.overflow-y-auto,
.overflow-x-auto,
.overflow-auto,
[class*="overflow-y-"],
[class*="overflow-x-"] {
  -webkit-overflow-scrolling: touch;
}

/* ════════════════════════════════════════════════════════════════
   WEBKIT SCROLLBAR — Chrome / Safari / Edge
   ════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #c1c1c1 #f1f1f1;
}

/* ════════════════════════════════════════════════════════════════
   FOCUS STYLES — Accessibility & cross-browser keyboard nav
   ════════════════════════════════════════════════════════════════ */
:focus-visible {
  outline: 3px solid #FF9933;
  outline-offset: 2px;
}

/* Remove default focus ring only when replaced by :focus-visible */
:focus:not(:focus-visible) {
  outline: none;
}

/* Fallback for browsers without :focus-visible */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #FF9933;
  outline-offset: 2px;
}

/* ════════════════════════════════════════════════════════════════
   SAFARI — GRADIENT TEXT CLIPPING
   Used for orange gradient text spans across the site.
   ════════════════════════════════════════════════════════════════ */
[class*="bg-clip-text"],
.bg-clip-text {
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ════════════════════════════════════════════════════════════════
   ANIMATION & TRANSITION — cross-browser prefixes
   ════════════════════════════════════════════════════════════════ */
@-webkit-keyframes fadeSlide {
  from {
    opacity: 0;
    -webkit-transform: translateY(-10px);
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
}

@-webkit-keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Prefix common transform properties for older WebKit */
.transition,
[class*="transition-"] {
  -webkit-transition-timing-function: ease;
  transition-timing-function: ease;
}

/* ════════════════════════════════════════════════════════════════
   SAFARI — BACKFACE VISIBILITY (prevents flicker on transforms)
   ════════════════════════════════════════════════════════════════ */
[class*="hover:scale"],
[class*="hover:-translate"],
[class*="hover:rotate"] {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* ════════════════════════════════════════════════════════════════
   PRINT STYLES — consistent rendering when printing
   ════════════════════════════════════════════════════════════════ */
@media print {

  nav,
  footer,
  #scroll-controls,
  .fixed,
  video,
  iframe[src*="translate"] {
    display: none !important;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  h1,
  h2,
  h3 {
    page-break-after: avoid;
  }

  p,
  li {
    orphans: 3;
    widows: 3;
  }
}

/* ════════════════════════════════════════════════════════════════
   HIGH CONTRAST MODE (Windows Forced Colors / -ms-high-contrast)
   ════════════════════════════════════════════════════════════════ */
@media (forced-colors: active) {
  a {
    color: LinkText;
  }

  button {
    forced-color-adjust: none;
  }
}

/* ════════════════════════════════════════════════════════════════
   GOOGLE TRANSLATE — SUPPRESS ALL NATIVE UI ELEMENTS
   Hides the floating icon, top banner bar, tooltip balloon, and
   any iframe/div Google Translate injects into the page.
   The body top-shift Google applies for its banner is also reset.
   ════════════════════════════════════════════════════════════════ */

/* Floating "G" translate icon */
.goog-te-floating-button-container,
.VIpgJd-ZVi9od-ORHb-OEVmcd,
.VIpgJd-ZVi9od-l4eHX-hSRGPd,
/* Banner frame at top of page */
.goog-te-banner-frame,
/* Tooltip balloon */
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-te-menu-frame,
/* Any iframe Google injects */
iframe.skiptranslate,
/* Gadget wrapper */
.goog-te-gadget,
div.skiptranslate,
/* Newer VIpgJd- prefixed elements */
[class^="VIpgJd-"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
}

/* Prevent Google Translate from pushing page content down */
body {
  top: 0 !important;
  position: static !important;
}

/* ════════════════════════════════════════════════════════════════
   CUSTOM TRANSLATION LOADER OVERLAY
   Shown while Google Translate is processing. Centred saffron
   spinner over a semi-transparent navy backdrop.
   ════════════════════════════════════════════════════════════════ */
#aibf-translate-loader {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  z-index: 99999 !important;
  background: rgba(12, 35, 64, 0.55) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  backdrop-filter: blur(4px) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 1.25rem !important;
  opacity: 0 !important;
  pointer-events: none !important;
  -webkit-transition: opacity 0.25s ease !important;
  transition: opacity 0.25s ease !important;
}

#aibf-translate-loader.aibf-loader-visible {
  opacity: 1 !important;
  pointer-events: all !important;
}

/* Outer ring track */
.aibf-spinner-ring {
  position: relative !important;
  width: 72px !important;
  height: 72px !important;
}

/* Spinning arc */
.aibf-spinner-ring::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  border-radius: 50% !important;
  border: 6px solid rgba(245, 166, 35, 0.20) !important;
  border-top-color: #F5A623 !important;
  -webkit-animation: aibf-spin 0.75s linear infinite !important;
  animation: aibf-spin 0.75s linear infinite !important;
}

/* Inner pulse dot */
.aibf-spinner-ring::after {
  content: '' !important;
  position: absolute !important;
  top: 20px !important;
  right: 20px !important;
  bottom: 20px !important;
  left: 20px !important;
  border-radius: 50% !important;
  background: #F5A623 !important;
  opacity: 0.25 !important;
  -webkit-animation: aibf-pulse 1.5s ease-in-out infinite !important;
  animation: aibf-pulse 1.5s ease-in-out infinite !important;
}

/* Label below spinner */
.aibf-spinner-label {
  color: #ffffff !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.05em !important;
  opacity: 0.85 !important;
}

@-webkit-keyframes aibf-spin {
  to {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@keyframes aibf-spin {
  to {
    transform: rotate(360deg);
  }
}

@-webkit-keyframes aibf-pulse {

  0%,
  100% {
    opacity: 0.15;
    -webkit-transform: scale(0.85);
    transform: scale(0.85);
  }

  50% {
    opacity: 0.45;
    -webkit-transform: scale(1.1);
    transform: scale(1.1);
  }
}

@keyframes aibf-pulse {

  0%,
  100% {
    opacity: 0.15;
    transform: scale(0.85);
  }

  50% {
    opacity: 0.45;
    transform: scale(1.1);
  }
}

/* ════════════════════════════════════════════════════════════════
   SHARED BUTTON STYLES — btn-primary & btn-secondary
   Used in Strategic Pillar hero sections and CTA blocks.
   Defined here so every page gets them (browser-compat loads on all).
   ════════════════════════════════════════════════════════════════ */

.btn-primary {
  background: linear-gradient(135deg, #0C2340, #1E3A5F) !important;
  color: #ffffff !important;
  padding: 0.875rem 2rem !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  font-size: 0.95rem !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease !important;
  border: none !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  text-decoration: none !important;
  line-height: 1.4 !important;
}

.btn-primary:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 10px 25px rgba(12, 35, 64, 0.25) !important;
  color: #ffffff !important;
  text-decoration: none !important;
}

.btn-secondary {
  background: #E98B38 !important;
  color: #ffffff !important;
  padding: 0.875rem 2rem !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  font-size: 0.95rem !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease !important;
  border: none !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  text-decoration: none !important;
  line-height: 1.4 !important;
}

.btn-secondary:hover {
  background: #d47828 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 10px 25px rgba(233, 139, 56, 0.3) !important;
  color: #ffffff !important;
  text-decoration: none !important;
}

/* ════════════════════════════════════════════════════════════════
   TRANSLATION FLASH PREVENTION
   Hides the page body before Google Translate re-applies on
   navigation, then fades back in once translation is complete.
   ════════════════════════════════════════════════════════════════ */
html.gt-pending body {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: none !important;
}

html.gt-reveal body {
  opacity: 1 !important;
  transition: opacity 0.25s ease !important;
}

/* ════════════════════════════════════════════════════════════════
   PAGE TRANSITIONS
   Strategy: let the browser hold the previous page natively while the
   new one loads — no artificial opacity-0 entry that causes a white
   flash. View Transitions API (Chrome/Edge 126+) provides a smooth
   screenshot-based crossfade for free; other browsers get instant
   clean loads with zero blank.
   Loader: thin saffron/gold bar shown only on slow loads (>120 ms).
   ════════════════════════════════════════════════════════════════ */

/* ── View Transitions API — native crossfade on same-origin navigation ── */
@view-transition {
  navigation: auto;
}

/* Default crossfade: 280 ms, ease — snappy but perceptible */
::view-transition-old(root) {
  animation: 280ms ease both aibf-vt-out;
}

::view-transition-new(root) {
  animation: 280ms ease both aibf-vt-in;
}

@keyframes aibf-vt-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes aibf-vt-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

/* ── Top progress bar ── */
#aibf-loader {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, #E98B38 0%, #F5C642 60%, #E98B38 100%);
  background-size: 200% 100%;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease;
}

#aibf-loader.aibf-loading {
  opacity: 1;
  width: 68%;
  animation: aibf-shimmer 1.4s linear infinite;
}

#aibf-loader.aibf-done {
  width: 100% !important;
  opacity: 0 !important;
  transition: width 0.15s ease, opacity 0.35s ease 0.12s !important;
  animation: none !important;
}

@keyframes aibf-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}