html {
  overflow-x: hidden;
}

body {
  background-color: #050505;
  color: #fafafa;
  margin: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  position: relative;
}

/* Subtle animated grain texture overlay */
body::before {
  content: "";
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  animation: noise-anim 8s steps(10) infinite;
}

@keyframes noise-anim {
  0%,
  100% {
    transform: translate(0, 0);
  }

  10% {
    transform: translate(-5%, -5%);
  }

  20% {
    transform: translate(-10%, 5%);
  }

  30% {
    transform: translate(5%, -10%);
  }

  40% {
    transform: translate(-5%, 15%);
  }

  50% {
    transform: translate(-10%, 5%);
  }

  60% {
    transform: translate(15%, 0);
  }

  70% {
    transform: translate(0, 10%);
  }

  80% {
    transform: translate(-15%, 0);
  }

  90% {
    transform: translate(10%, 5%);
  }
}

/* Soft architectural light source */
.void-bg {
  background: radial-gradient(
    ellipse at 80% -20%,
    rgba(60, 60, 60, 0.15) 0%,
    rgba(5, 5, 5, 1) 60%
  );
}

.btn-primary {
  background-color: #fafafa;
  color: #050505;
  border: 1px solid #fafafa;
}

/* Subtle grid lines */
.grid-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(
      to right,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px
    ),
    linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px
    );
  background-size: 100px 100px;
  mask-image: radial-gradient(circle at center, black 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at center, black 20%, transparent 80%);
}

/* Precision instrument frame borders */
.frame-border {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
  z-index: 0;
}

.frame-top-bottom {
  left: 48px;
  right: 48px;
  top: 80px;
  bottom: 64px;
  border-left: none;
  border-right: none;
}

.frame-left-right {
  top: 40px;
  bottom: 40px;
  left: 96px;
  right: 96px;
  border-top: none;
  border-bottom: none;
}

.transform-center {
  transform-origin: center;
}

/* Fix layout on small screens purely through CSS without modifying HTML */
@media (max-width: 1024px) {
  html {
    overflow-x: hidden !important;
  }

  body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  body::before,
  .grid-bg {
    position: fixed !important;
  }

  .frame-border {
    display: none !important;
  }

  header {
    width: 95% !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-top: 0.7rem !important;
    padding-bottom: 0.7rem !important;
  }

  main {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
    padding-top: 6rem !important;
    padding-bottom: 6rem !important;
  }

  footer {
    position: static !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
    padding: 2rem !important;
  }

  /* Prevent social links from clipping on narrower mobile widths */
  footer > div:last-child {
    flex-wrap: wrap !important;
    justify-content: center !important;
    row-gap: 0.75rem !important;
    column-gap: 1.5rem !important;
  }

  footer > div:last-child > :not([hidden]) ~ :not([hidden]) {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  main > div[aria-hidden="true"] {
    opacity: 0.05 !important;
    right: -50% !important;
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 3rem;
  width: 90%;
  max-width: 500px;
  border-radius: 2rem;
  transform: translateY(20px);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

/* Mobile UX: use bottom-sheet style modal instead of centered card */
@media (max-width: 768px) {
  .modal-overlay {
    align-items: flex-end;
  }

  .modal-content {
    width: 100%;
    max-width: none;
    border-radius: 1.25rem 1.25rem 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 1.5rem 1.25rem 1.75rem;
    transform: translateY(100%);
  }
}

.form-input {
  width: 100% !important;
  background-color: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #fafafa !important;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin-top: 0.5rem;
  transition: all 0.3s ease;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
}

/* Ensure autofill doesn't turn the fields white */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fafafa !important;
  -webkit-box-shadow: 0 0 0px 1000px #0d0d0d inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

.form-input::placeholder {
  color: rgba(255, 255, 255, 0.1);
}

.form-input:focus {
  outline: none !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  background-color: rgba(255, 255, 255, 0.06) !important;
}

textarea.form-input {
  resize: none;
  min-height: 100px;
}

.close-modal {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.4);
  transition: color 0.3s ease;
  background: transparent;
  border: 0;
  padding: 0;
  line-height: 1;
}

.close-modal:hover {
  color: white;
}

/* Accessibility helpers (no visual impact unless focused) */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border-width: 0 !important;
}

.not-sr-only {
  position: static !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 999;
  padding: 0.75rem 1rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fafafa;
  backdrop-filter: blur(10px);
}

.focus\:not-sr-only:focus {
  clip: auto !important;
  height: auto !important;
  width: auto !important;
  margin: 0 !important;
  overflow: visible !important;
  position: fixed !important;
  white-space: normal !important;
}

