@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --ink: #111317;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(251, 250, 248, 0.9) 0%, rgba(246, 245, 242, 0.94) 45%, rgba(255, 255, 255, 0.96) 100%),
    url('/assets/New-optic-BG-mobile.webp') center top / cover scroll,
    linear-gradient(180deg, #fbfaf8 0%, #f6f5f2 42%, #ffffff 100%);
  color: var(--ink);
  font-family: var(--font-sans), system-ui, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

section[id] {
  scroll-margin-top: 7rem;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: -1;
  border-radius: 999px;
  filter: blur(42px);
  opacity: 0.55;
  animation: ambient-drift 14s ease-in-out infinite alternate;
}

body::before {
  left: 6vw;
  top: 18vh;
  width: 22rem;
  height: 22rem;
  background: rgba(49, 95, 143, 0.16);
}

body::after {
  right: 5vw;
  top: 54vh;
  width: 18rem;
  height: 18rem;
  background: rgba(216, 221, 229, 0.74);
  animation-delay: -5s;
}

body[dir="rtl"] {
  font-family: var(--font-arabic), system-ui, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: rgba(49, 95, 143, 0.18);
}

.glass {
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 60px rgba(17, 19, 23, 0.08);
  backdrop-filter: blur(24px);
}

.premium-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.06) 42%, rgba(255, 255, 255, 0.2)),
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.55), transparent 34%),
    radial-gradient(circle at 82% 100%, rgba(49, 95, 143, 0.12), transparent 38%);
  opacity: 0.72;
  mix-blend-mode: screen;
}

.premium-glass::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -18px 32px rgba(49, 95, 143, 0.08),
    inset 18px 0 34px rgba(255, 255, 255, 0.12);
}

.hairline {
  background: linear-gradient(90deg, transparent, rgba(17, 19, 23, 0.15), transparent);
  height: 1px;
}

.liquidGL-pane {
  overflow: hidden;
  isolation: isolate;
}

.floating-sheen {
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 34%, rgba(255, 255, 255, 0.34) 49%, transparent 62%);
  transform: translateX(-45%) rotate(8deg);
  animation: sheen-pass 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ambient-drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(2.5rem, -1.5rem, 0) scale(1.12);
  }
}

@keyframes sheen-pass {
  0%, 48% {
    transform: translateX(-55%) rotate(8deg);
    opacity: 0;
  }
  58% {
    opacity: 0.55;
  }
  78%, 100% {
    transform: translateX(55%) rotate(8deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1023px) {
  body::before,
  body::after {
    display: none;
  }

  .floating-sheen {
    animation: none;
    opacity: 0;
  }

  .glass,
  [class*="backdrop-blur"] {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .glass {
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 10px 30px rgba(17, 19, 23, 0.07);
  }

  .premium-glass::before,
  .premium-glass::after {
    display: none;
  }

  main > section {
    content-visibility: auto;
    contain-intrinsic-size: 1px 780px;
  }

  main > section:first-child {
    content-visibility: visible;
    contain-intrinsic-size: auto;
  }

  * {
    transition-duration: 160ms !important;
  }
}

@media (max-width: 767px) {
  .shadow-glass,
  .shadow-soft {
    box-shadow: 0 10px 24px rgba(17, 19, 23, 0.08) !important;
  }
}

@media (min-width: 1024px) {
  body {
    background:
      linear-gradient(180deg, rgba(251, 250, 248, 0.86) 0%, rgba(246, 245, 242, 0.92) 45%, rgba(255, 255, 255, 0.94) 100%),
      url('/assets/New-optic-BG.png') center top / cover fixed,
      radial-gradient(circle at top left, rgba(49, 95, 143, 0.13), transparent 34rem),
      radial-gradient(circle at 82% 12%, rgba(216, 221, 229, 0.9), transparent 24rem),
      linear-gradient(180deg, #fbfaf8 0%, #f6f5f2 42%, #ffffff 100%);
  }
}
