/* BBC Reith Sans Font Definitions */
@font-face {
  font-family: 'BBC Reith Sans';
  src: url('/fonts/BBCReithSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'BBC Reith Sans';
  src: url('/fonts/BBCReithSans-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'BBC Reith Sans';
  src: url('/fonts/BBCReithSans-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}


/* React Native Default Style Matching */
:root {
  /* System colors matching React Native defaults */
  --primary-color: #2171F5;
  --background-color: #2f689f;
  --text-color: #000000;
  --disabled-color: rgba(0, 0, 0, 0.26);
  --border-color: #E1E4E8;

  /* Font sizes to match React Native text styles */
  --font-size-xs: 12px;
  --font-size-s: 14px;
  --font-size-m: 16px;
  --font-size-l: 18px;
  --font-size-xl: 20px;
  --font-size-xxl: 24px;

  /* System spacing to match React Native defaults */
  --spacing-xs: 4px;
  --spacing-s: 8px;
  --spacing-m: 16px;
  --spacing-l: 24px;
  --spacing-xl: 32px;
  --spacing-xxl: 40px;

  /* Viewport height fix */
  --vh: 1vh;
}

/* Global Reset and Base Styles */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100% ;
  width: 100% ;
  overflow: hidden ;
  padding: 0 ;
  margin: 0 ;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  text-rendering: optimizeLegibility;
}

html {
  scroll-behavior: smooth;
  /* Prevent text size change on orientation change https://gist.github.com/tfausak/2222823#file-ios-8-web-app-html-L138 */
  -webkit-text-size-adjust: 100%;
  height: calc(100% + env(safe-area-inset-top));
}

body {
  font-family: 'BBC Reith Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  font-size: var(--font-size-m);
  line-height: 1.5;
  font-weight: 400;
  position: fixed ;
  inset: 0 ;
}

input {
  &:-webkit-autofill,
  &:-webkit-autofill:focus {
    transition:
            background-color 0s 600000s,
            color 0s 600000s !important;
  }
}

/* React Native-like behavior for text */
p, h1, h2, h3, h4, h5, h6 {
  margin: 0;
  padding: 0;
}

p {
  white-space: pre-line;
}

/* React Native-like Flexbox behavior */
#root {
  display: flex ;
  position: relative;
  flex:1;
  flex-shrink: 0;
  flex-basis: auto;
  flex-grow: 1;
  flex-direction: column ;
  width: 100%;
  /* To smooth any scrolling behavior */
  -webkit-overflow-scrolling: touch;
  margin: 0px;
  padding: 0px;
  /* Allows content to fill the viewport and go beyond the bottom */
  min-height: 100%;
}


/* Smooth animation settings */
.animated,
[class*="react-native"],
[class*="rn-"] {
  transition-property: transform, opacity, background-color, color, border;
  transition-duration: 300ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0.2, 1); /* React Native Easing.out */
  will-change: transform, opacity;
  backface-visibility: hidden; /* Prevents flickering in some browsers */
  transform: translateZ(0); /* Force GPU acceleration */
}

/* Make transforms hardware accelerated by default */
div, span, img, button, a {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Touch interactions more like mobile */
button,
[role="button"],
a,
input,
select,
textarea {
  touch-action: manipulation;
}

/* Scrolling behavior more like mobile */
.scroll-container {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Disable browser focus outlines for most elements, similar to React Native */
input:focus,
button:focus,
select:focus,
textarea:focus,
a:focus {
  outline: none;
}

/* Hide scrollbars but maintain functionality (optional) */
::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

/* Support for React Native Web animations */
.transform-origin-center {
  transform-origin: center;
}

.react-native-text {
  display: inline;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
img {
  pointer-events: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

/* Prevent flicker during animations */
* {
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
