/* ===============================
   GLOBAL SAFETY + LAYOUT
================================ */
html { scroll-behavior: auto; }

body {
  max-width: 100%;
  overflow-x: clip; /* modern; prevents sideways scroll without weird clipping */
}

/* Fallback if needed (older browsers) */
@supports not (overflow-x: clip) {
  body { overflow-x: hidden; }
}

/* ===============================
   HERO BACKGROUND (STARFIELD)
================================ */
.hero-section {
  position: relative;
  background-color: #010213;
  overflow: hidden;
}

.hero-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(255,255,255,.9) 1px, transparent 2px),
    radial-gradient(circle at 70% 80%, rgba(255,255,255,.85) 1.5px, transparent 2.5px),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.75) 1px, transparent 2px),
    radial-gradient(circle at 20% 75%, rgba(255,255,255,.6) 1px, transparent 2px),
    radial-gradient(circle at 85% 30%, rgba(255,255,255,.7) 1px, transparent 2px),
    radial-gradient(circle at 35% 15%, rgba(255,255,255,.5) 1px, transparent 2px);
  background-size: 260px 260px;
  animation: starfield-scroll 22s linear infinite;
  opacity: 0.65;
  pointer-events: none;
  transform: translateZ(0);
}

@keyframes starfield-scroll {
  from { background-position: 0 0; }
  to   { background-position: 0 120%; }
}

/* ===============================
   REVEAL ANIMATIONS (SMOOTHER)
================================ */
.reveal-from-right,
.reveal-from-left-slow,
.reveal-child {
  will-change: transform, opacity;
  transform: translateZ(0);
}

.reveal-from-right {
  opacity: 0;
  transform: translate3d(24px, 0, 0);
  transition: transform 600ms cubic-bezier(.2,.8,.2,1), opacity 600ms ease;
}

.reveal-from-right.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.reveal-from-left-slow {
  opacity: 0;
  transform: translate3d(-32px, 0, 0);
  transition: transform 1100ms cubic-bezier(.2,.8,.2,1), opacity 1100ms ease;
}

.reveal-from-left-slow.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.reveal-child {
  opacity: 0;
  transform: translate3d(-18px, 0, 0);
  transition: transform 950ms cubic-bezier(.2,.8,.2,1), opacity 950ms ease;
}

.reveal-child.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* ===============================
   TYPEWRITER (MOBILE SAFE + NO JUMP)
================================ */
.type-line .typed-text {
  display: inline;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.type-line.is-typing .typed-text {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  border-right: 2px solid rgba(255,255,255,0.6);
  padding-right: 2px;
  animation: caretBlink 900ms step-end infinite;
}

@keyframes caretBlink {
  0%, 49% { border-right-color: rgba(255,255,255,0.65); }
  50%,100% { border-right-color: rgba(255,255,255,0); }
}

.type-line.is-done .typed-text {
  border-right: none;
  animation: none;
}

/* ===============================
   REUSABLE UI CLASSES (YOU USE THESE)
================================ */
.navlink {
  color: rgba(226, 232, 240, .9);
  transition: color .2s ease, opacity .2s ease;
}
.navlink:hover { color: #fff; opacity: .95; }
.navlink:focus {
  outline: 2px solid rgba(255,255,255,.25);
  outline-offset: 4px;
  border-radius: 12px;
}

.service-card,
.work-card {
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 12px 35px rgba(0,0,0,.35);
}

/* ===============================
   MODAL SAFETY FIXES
   (prevents “transparent on mobile” edge cases)
================================ */
/* If modal is open (aria-hidden=false), force opacity */
#videoModal[aria-hidden="false"],
#logoModal[aria-hidden="false"] {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* If panel should be visible (when JS adds opacity-100), ensure it wins */
#videoModalPanel.opacity-100,
#logoModalPanel.opacity-100 {
  opacity: 1 !important;
}

/* ===============================
   REDUCED MOTION
================================ */
@media (prefers-reduced-motion: reduce) {
  .hero-section::before { animation: none !important; }

  .reveal-from-right,
  .reveal-from-left-slow,
  .reveal-child {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .type-line .typed-text {
    border-right: none !important;
    animation: none !important;
  }
}
